Skip to content

Commit

Permalink
fix: create project <-> unit association on session create
Browse files Browse the repository at this point in the history
  • Loading branch information
39bytes committed Apr 18, 2024
1 parent d5fb4b7 commit fc8f4d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/server/src/db/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ export async function createSession(
);
}

// create the association if it doesn't exist already
await db
.insertInto("project_unit")
.values({
projectId: station.projectId,
unitId: unit.id,
})
.onConflict((oc) => oc.doNothing())
.execute();

const totalTime = _.sumBy(measurements, (m) => m.durationMs);

const toInsert = {
Expand Down

0 comments on commit fc8f4d5

Please sign in to comment.