Skip to content

Commit 568b82d

Browse files
committed
feat(recruiter): invite team members to new slack channels
1 parent 0fc2fd6 commit 568b82d

6 files changed

Lines changed: 13 additions & 2 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ The migration generator compares entities against the local database schema. Ens
8787
- We favor type safety throughout the codebase. Use TypeScript interfaces and types for compile-time type checking.
8888
- **Zod schemas** are preferred for runtime validation, especially for input validation, API boundaries, and data parsing. Zod provides both type inference and runtime validation, making it ideal for verifying user input, API payloads, and external data sources.
8989
- **This project uses Zod 4.x** (currently 4.3.5). Be aware of API differences from Zod 3.x:
90+
- **Primitive types are now top-level**: Use `z.email()` instead of `z.string().email()`, `z.uuid()` instead of `z.string().uuid()`, `z.url()` instead of `z.string().url()`
9091
- `z.literal([...])` in Zod 4.x supports arrays and validates that the value matches one of the array elements
9192
- For enum-like validation of string literals, both `z.literal([...])` and `z.enum([...])` work in Zod 4.x
9293
- Always consult the [Zod 4.x documentation](https://zod.dev) for the latest API

__tests__/schema/opportunity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5827,7 +5827,7 @@ describe('mutation createSharedSlackChannel', () => {
58275827
});
58285828
expect(mockConversationsInviteShared).toHaveBeenCalledWith({
58295829
channel: 'C1234567890',
5830-
emails: ['user@example.com'],
5830+
emails: ['user@example.com', 'support@daily.dev'],
58315831
external_limited: true,
58325832
});
58335833

__tests__/setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jest.mock('../src/remoteConfig', () => ({
4545
organization: 'pro_01jvm22wepxc0x539bc4w6jybx',
4646
recruiter: 'pro_recruiter',
4747
},
48+
recruiterChannelInviteEmails: ['support@daily.dev'],
4849
} as typeof remoteConfig.vars,
4950
validLanguages: {
5051
en: 'English',

src/common/schema/opportunities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ export const createSharedSlackChannelSchema = z.object({
334334
),
335335
});
336336

337+
export const recruiterChannelInviteEmailsSchema = z.array(z.email());
338+
337339
export const opportunityMatchesQuerySchema = z.object({
338340
opportunityId: z.string(),
339341
status: z

src/remoteConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type RemoteConfigValue = {
3030
paddleIps: string[];
3131
paddleTestDiscountIds: string[];
3232
paddleProductIds: Partial<Record<PurchaseType, string>>;
33+
recruiterChannelInviteEmails: string[];
3334
funnelIds: Partial<{
3435
web_funnel_id: string;
3536
onboarding_funnel_id: string;

src/schema/opportunity.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import z from 'zod';
22
import { IResolvers } from '@graphql-tools/utils';
33
import { GraphQLResolveInfo } from 'graphql';
44
import { traceResolvers } from './trace';
5+
import { remoteConfig } from '../remoteConfig';
56
import { AuthContext, BaseContext, type Context } from '../Context';
67
import graphorm, { LocationVerificationStatus } from '../graphorm';
78
import {
@@ -60,6 +61,7 @@ import {
6061
reimportOpportunitySchema,
6162
opportunityMatchesQuerySchema,
6263
addOpportunitySeatsSchema,
64+
recruiterChannelInviteEmailsSchema,
6365
} from '../common/schema/opportunities';
6466
import {
6567
ensureOpportunityPermissions,
@@ -2540,9 +2542,13 @@ export const resolvers: IResolvers<unknown, BaseContext> = traceResolvers<
25402542
return { _: false };
25412543
}
25422544

2545+
const csEmails = recruiterChannelInviteEmailsSchema.parse(
2546+
remoteConfig.vars.recruiterChannelInviteEmails ?? [],
2547+
);
2548+
25432549
await slackClient.inviteSharedToConversation(
25442550
createResult.channel.id as string,
2545-
[email],
2551+
[email, ...csEmails],
25462552
true,
25472553
);
25482554

0 commit comments

Comments
 (0)