Skip to content

Commit 39de1b4

Browse files
committed
feat: only claim opportunities without organization
1 parent cde6394 commit 39de1b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/common/opportunity/user.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { EntityManager } from 'typeorm';
1+
import { IsNull, type EntityManager } from 'typeorm';
22
import { OpportunityJob } from '../../entity/opportunities/OpportunityJob';
33
import { updateFlagsStatement } from '../utils';
44
import type { Opportunity } from '../../entity/opportunities/Opportunity';
@@ -32,6 +32,9 @@ export const claimAnonOpportunities = async ({
3232
.where("flags->>'anonUserId' = :anonUserId", {
3333
anonUserId,
3434
})
35+
.andWhere({
36+
organizationId: IsNull(), // only claim opportunities not linked to an organization yet
37+
})
3538
.returning(['id'])
3639
.execute();
3740

0 commit comments

Comments
 (0)