@@ -5,11 +5,16 @@ import { z } from "zod/v4";
5
5
6
6
export const orgLeadEntry = z . object ( {
7
7
name : z . optional ( z . string ( ) ) ,
8
- username : z . email ( ) ,
8
+ username : z . email ( ) . refine (
9
+ ( email ) => email . endsWith ( '@illinois.edu' ) ,
10
+ { message : 'Email must be from the @illinois.edu domain' }
11
+ ) ,
9
12
title : z . optional ( z . string ( ) )
10
13
} )
11
14
12
- export const validOrgLinkTypes = [ "DISCORD" , "CAMPUSWIRE" , "SLACK" , "NOTION" , "MATRIX" , "OTHER" ] as const as [ string , ...string [ ] ] ;
15
+ export type LeadEntry = z . infer < typeof orgLeadEntry > ;
16
+
17
+ export const validOrgLinkTypes = [ "DISCORD" , "CAMPUSWIRE" , "SLACK" , "NOTION" , "MATRIX" , "INSTAGRAM" , "OTHER" ] as const as [ string , ...string [ ] ] ;
13
18
14
19
export const orgLinkEntry = z . object ( {
15
20
type : z . enum ( validOrgLinkTypes ) ,
@@ -18,7 +23,6 @@ export const orgLinkEntry = z.object({
18
23
19
24
export const enforcedOrgLeadEntry = orgLeadEntry . extend ( { name : z . string ( ) . min ( 1 ) , title : z . string ( ) . min ( 1 ) } )
20
25
21
-
22
26
export const getOrganizationInfoResponse = z . object ( {
23
27
id : z . enum ( AllOrganizationList ) ,
24
28
description : z . optional ( z . string ( ) ) ,
@@ -28,8 +32,10 @@ export const getOrganizationInfoResponse = z.object({
28
32
leadsEntraGroupId : z . optional ( z . string ( ) . min ( 1 ) ) . meta ( { description : `Only returned for users with the ${ AppRoleHumanMapper [ AppRoles . ALL_ORG_MANAGER ] } role.` } )
29
33
} )
30
34
31
- export const setOrganizationMetaBody = getOrganizationInfoResponse . omit ( { id : true , leads : true } ) ;
35
+ export const setOrganizationMetaBody = getOrganizationInfoResponse . omit ( { id : true , leads : true , leadsEntraGroupId : true } ) ;
32
36
export const patchOrganizationLeadsBody = z . object ( {
33
37
add : z . array ( enforcedOrgLeadEntry ) ,
34
38
remove : z . array ( z . string ( ) )
35
39
} ) ;
40
+
41
+ export const ORG_DATA_CACHED_DURATION = 300 ;
0 commit comments