Skip to content

Commit 22d8dd0

Browse files
authored
feat: add public flags to opportunity (batchSize) (#3346)
1 parent bad9303 commit 22d8dd0

6 files changed

Lines changed: 51 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@connectrpc/connect-fastify": "^1.6.1",
3737
"@connectrpc/connect-node": "^1.6.1",
3838
"@dailydotdev/graphql-redis-subscriptions": "^2.4.3",
39-
"@dailydotdev/schema": "0.2.55",
39+
"@dailydotdev/schema": "0.2.58",
4040
"@dailydotdev/ts-ioredis-pool": "^1.0.2",
4141
"@fastify/cookie": "^11.0.2",
4242
"@fastify/cors": "^11.1.0",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/entity/opportunities/Opportunity.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ export type OpportunityFlags = Partial<{
2828
userIds: string[];
2929
totalCount: number;
3030
};
31+
batchSize: number;
3132
}>;
3233

34+
export type OpportunityFlagsPublic = Pick<OpportunityFlags, 'batchSize'>;
35+
3336
@Entity()
3437
@TableInheritance({ column: { type: 'text', name: 'type' } })
3538
export class Opportunity {

src/graphorm/index.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ import {
4242
import { GQLComment } from '../schema/comments';
4343
import { GQLUserPost } from '../schema/posts';
4444
import { UserComment } from '../entity/user/UserComment';
45-
import { type ContentLanguage, type I18nRecord, UserVote } from '../types';
45+
import {
46+
type ContentLanguage,
47+
type I18nRecord,
48+
opportunityMatchBatchSize,
49+
UserVote,
50+
} from '../types';
4651
import { whereVordrFilter } from '../common/vordr';
4752
import { UserCompany, Post } from '../entity';
4853
import {
@@ -66,7 +71,10 @@ import { OrganizationLinkType } from '../common/schema/organizations';
6671
import type { GCSBlob } from '../common/schema/userCandidate';
6772
import { QuestionType } from '../entity/questions/types';
6873
import { snotraClient } from '../integrations/snotra';
69-
import type { Opportunity } from '../entity/opportunities/Opportunity';
74+
import type {
75+
Opportunity,
76+
OpportunityFlagsPublic,
77+
} from '../entity/opportunities/Opportunity';
7078
import { SubscriptionStatus } from '../common/plus';
7179

7280
const existsByUserAndPost =
@@ -1586,6 +1594,14 @@ const obj = new GraphORM({
15861594
return value?.status || SubscriptionStatus.None;
15871595
},
15881596
},
1597+
flags: {
1598+
jsonType: true,
1599+
transform: (value: OpportunityFlagsPublic): OpportunityFlagsPublic => {
1600+
return {
1601+
batchSize: value?.batchSize ?? opportunityMatchBatchSize,
1602+
};
1603+
},
1604+
},
15891605
},
15901606
},
15911607
OpportunityScreeningQuestion: {

src/schema/opportunity.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ import { ConnectionArguments } from 'graphql-relay';
9696
import { ProfileResponse, snotraClient } from '../integrations/snotra';
9797
import { slackClient } from '../common/slack';
9898
import { fileTypeFromBuffer } from 'file-type';
99-
import { acceptedOpportunityFileTypes } from '../types';
99+
import {
100+
acceptedOpportunityFileTypes,
101+
opportunityMatchBatchSize,
102+
} from '../types';
100103
import { getBrokkrClient } from '../common/brokkr';
101104
import { garmScraperService } from '../common/scraper';
102105
import { Storage } from '@google-cloud/storage';
@@ -110,7 +113,14 @@ import type { GQLSource } from './sources';
110113
export interface GQLOpportunity
111114
extends Pick<
112115
Opportunity,
113-
'id' | 'type' | 'state' | 'title' | 'tldr' | 'content' | 'keywords'
116+
| 'id'
117+
| 'type'
118+
| 'state'
119+
| 'title'
120+
| 'tldr'
121+
| 'content'
122+
| 'keywords'
123+
| 'flags'
114124
> {
115125
createdAt: Date;
116126
updatedAt: Date;
@@ -273,6 +283,13 @@ export const typeDefs = /* GraphQL */ `
273283
edges: [OpportunityEdge!]!
274284
}
275285
286+
"""
287+
Flags for the opportunity
288+
"""
289+
type OpportunityFlagsPublic {
290+
batchSize: Int
291+
}
292+
276293
type Opportunity {
277294
id: ID!
278295
type: ProtoEnumValue!
@@ -288,6 +305,7 @@ export const typeDefs = /* GraphQL */ `
288305
questions: [OpportunityScreeningQuestion]!
289306
feedbackQuestions: [OpportunityFeedbackQuestion]!
290307
subscriptionStatus: SubscriptionStatus!
308+
flags: OpportunityFlagsPublic
291309
}
292310
293311
type OpportunityMatchDescription {
@@ -2349,6 +2367,8 @@ export const resolvers: IResolvers<unknown, BaseContext> = traceResolvers<
23492367
flags.anonUserId = ctx.trackingId; // save tracking id to attribute later
23502368
}
23512369

2370+
flags.batchSize = opportunityMatchBatchSize;
2371+
23522372
const opportunity = await entityManager
23532373
.getRepository(OpportunityJob)
23542374
.save(

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,5 @@ export type TLocation = {
317317
export const acceptedOpportunityFileTypes = acceptedResumeFileTypes;
318318

319319
export const acceptedOpportunityExtensions = acceptedResumeExtensions;
320+
321+
export const opportunityMatchBatchSize = 50;

0 commit comments

Comments
 (0)