Skip to content

Commit a9b4d61

Browse files
authored
fix new-server endpoints (#531)
1 parent a3b6e5c commit a9b4d61

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

apps/server-new/src/http/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const postConnectAddAppIdentityToSpacesEndpoint = HttpApiEndpoint.post(
108108
}),
109109
)
110110
.setPayload(Messages.RequestConnectAddAppIdentityToSpaces)
111-
.addSuccess(Schema.Void)
111+
.addSuccess(Schema.Void, { status: 200 })
112112
.addError(Errors.AuthenticationError, { status: 401 })
113113
.addError(Errors.AuthorizationError, { status: 401 })
114114
.addError(Errors.ValidationError, { status: 400 })
@@ -169,7 +169,7 @@ export const postConnectAppIdentityEndpoint = HttpApiEndpoint.post('postConnectA
169169
}),
170170
)
171171
.setPayload(Messages.RequestConnectCreateAppIdentity)
172-
.addSuccess(Schema.Void)
172+
.addSuccess(AppIdentityResponse)
173173
.addError(Errors.AuthenticationError, { status: 401 })
174174
.addError(Errors.AuthorizationError, { status: 401 })
175175
.addError(Errors.ResourceAlreadyExistsError, { status: 400 })
@@ -230,7 +230,7 @@ export const postSpaceInboxMessageEndpoint = HttpApiEndpoint.post(
230230
'postSpaceInboxMessage',
231231
)`/spaces/${spaceId}/inboxes/${inboxId}/messages`
232232
.setPayload(Messages.RequestCreateSpaceInboxMessage)
233-
.addSuccess(Schema.Void)
233+
.addSuccess(Schema.Void, { status: 200 })
234234
.addError(Errors.ValidationError, { status: 400 })
235235
.addError(Errors.AuthorizationError, { status: 403 })
236236
.addError(Errors.ResourceNotFoundError, { status: 404 })
@@ -251,7 +251,7 @@ export const postAccountInboxMessageEndpoint = HttpApiEndpoint.post(
251251
'postAccountInboxMessage',
252252
)`/accounts/${accountAddress}/inboxes/${inboxId}/messages`
253253
.setPayload(Messages.RequestCreateAccountInboxMessage)
254-
.addSuccess(Schema.Void)
254+
.addSuccess(Schema.Void, { status: 200 })
255255
.addError(Errors.ValidationError, { status: 400 })
256256
.addError(Errors.AuthorizationError, { status: 403 })
257257
.addError(Errors.ResourceNotFoundError, { status: 404 })

apps/server-new/src/http/handlers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ const ConnectGroupLive = HttpApiBuilder.group(Api.hypergraphApi, 'Connect', (han
271271
const sessionTokenExpires = new Date(Date.now() + 1000 * 60 * 60 * 24 * 30); // 30 days
272272

273273
// Create the app identity
274-
yield* appIdentityService
274+
const appIdentity = yield* appIdentityService
275275
.createAppIdentity({
276276
accountAddress,
277277
appId: payload.appId,
@@ -285,6 +285,8 @@ const ConnectGroupLive = HttpApiBuilder.group(Api.hypergraphApi, 'Connect', (han
285285
sessionTokenExpires,
286286
})
287287
.pipe(Effect.orDie);
288+
289+
return { appIdentity };
288290
}),
289291
);
290292
}).pipe(

apps/server-new/src/services/app-identity.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ export interface AppIdentityResult {
2020
accountProof: string;
2121
keyProof: string;
2222
sessionToken: string | null;
23-
sessionNonce: string | null;
2423
sessionTokenExpires: Date | null;
25-
createdAt: Date;
26-
updatedAt: Date;
2724
}
2825

2926
export interface CreateAppIdentityParams {
@@ -54,7 +51,7 @@ export class AppIdentityService extends Context.Tag('AppIdentityService')<
5451
}) => Effect.Effect<AppIdentityResult, ResourceNotFoundError | DatabaseService.DatabaseError>;
5552
readonly createAppIdentity: (
5653
params: CreateAppIdentityParams,
57-
) => Effect.Effect<void, ResourceAlreadyExistsError | DatabaseService.DatabaseError>;
54+
) => Effect.Effect<AppIdentityResult, ResourceAlreadyExistsError | DatabaseService.DatabaseError>;
5855
}
5956
>() {}
6057

0 commit comments

Comments
 (0)