Skip to content

Commit

Permalink
All Groups should result in db save
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Jun 13, 2024
1 parent f79bd4c commit 10ee84a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/routes/connection-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,20 @@ export default async function router(schema: Schema, config: Config) {
throw new Err(400, null, 'MissionDiff can only be used when role is: MISSION_READONLY_SUBSCRIBER')
}

const data = await config.models.Data.generate({
let data = await config.models.Data.generate({
...req.body,
connection: req.params.connectionid
});

try {
await DataMission.sync(config, data);
const mission = await DataMission.sync(config, data);

if (mission) {
data = await config.models.Data.commit(data.id, {
updated: sql`Now()`,
mission_groups: Array.isArray(mission.groups) ? mission.groups : [mission.groups]
});
}
} catch (err) {
return res.json({
mission_exists: false,
Expand Down

0 comments on commit 10ee84a

Please sign in to comment.