@@ -105,8 +105,13 @@ type UserFromDB = {
105
105
role : UserRole ;
106
106
homePhoneNumber : string | null ;
107
107
workPhoneNumber : string | null ;
108
- avatarMimeType : "image/avif" | "image/jpeg" | "image/png" | "image/webp" | null
109
- avatarBase64 : string | null ;
108
+ avatarMimeType :
109
+ | "image/avif"
110
+ | "image/jpeg"
111
+ | "image/png"
112
+ | "image/webp"
113
+ | null ;
114
+ avatarBase64 : string | null ;
110
115
educationGrade : string | null ;
111
116
employmentStatus : string | null ;
112
117
maritalStatus : string | null ;
@@ -223,11 +228,6 @@ const resolveCreator = async (
223
228
} ) ;
224
229
}
225
230
226
- // Early return if organization has no creator
227
- if ( parent . creatorId === null ) {
228
- return null ;
229
- }
230
-
231
231
const currentUserOrganizationMembership =
232
232
currentUser . organizationMembershipsWhereMember [ 0 ] ;
233
233
@@ -295,7 +295,7 @@ describe("Organization Resolver - Creator Field", () => {
295
295
await resolveCreator (
296
296
mockOrganization ,
297
297
{ } ,
298
- testCtx as unknown as ResolverContext ,
298
+ testCtx , // Ensure createMockContext returns the correct type
299
299
) ;
300
300
} ) . rejects . toThrow (
301
301
new TalawaGraphQLError ( {
@@ -376,24 +376,24 @@ describe("Organization Resolver - Creator Field", () => {
376
376
} ) ,
377
377
) ;
378
378
} ) ;
379
- } ) ;
380
379
381
- it ( "should throw unauthorized error if user has no organization membership" , async ( ) => {
382
- const mockUser = createCompleteMockUser ( "regular" , [ ] ) ;
383
- ctx . drizzleClient . query . usersTable . findFirst . mockResolvedValueOnce ( mockUser ) ;
384
-
385
- await expect ( async ( ) => {
386
- await resolveCreator (
387
- mockOrganization ,
388
- { } ,
389
- ctx as unknown as ResolverContext ,
390
- ) ;
391
- } ) . rejects . toThrow (
392
- new TalawaGraphQLError ( {
393
- extensions : { code : "unauthorized_action" } ,
394
- } ) ,
395
- ) ;
396
- } ) ;
380
+ it ( "should throw unauthorized error if user has no organization membership" , async ( ) => {
381
+ const mockUser = createCompleteMockUser ( "regular" , [ ] ) ;
382
+ ctx . drizzleClient . query . usersTable . findFirst . mockResolvedValueOnce ( mockUser ) ;
383
+
384
+ await expect ( async ( ) => {
385
+ await resolveCreator (
386
+ mockOrganization ,
387
+ { } ,
388
+ ctx as unknown as ResolverContext ,
389
+ ) ;
390
+ } ) . rejects . toThrow (
391
+ new TalawaGraphQLError ( {
392
+ extensions : { code : "unauthorized_action" } ,
393
+ } ) ,
394
+ ) ;
395
+ } ) ;
396
+ } ) ;
397
397
398
398
describe ( "Error Handling" , ( ) => {
399
399
it ( "should throw unexpected error if creator user is not found" , async ( ) => {
0 commit comments