Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/api/v2/src/ee/me/me.controller.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ describe("Me Endpoints", () => {
expect(responseBody.data.id).toEqual(user.id);
expect(responseBody.data.email).toEqual(user.email);
expect(responseBody.data.name).toEqual(user.name);
expect(responseBody.data.avatarUrl).toEqual(user.avatarUrl);
expect(responseBody.data.bio).toEqual(user.bio);
expect(responseBody.data.timeFormat).toEqual(user.timeFormat);
expect(responseBody.data.defaultScheduleId).toEqual(user.defaultScheduleId);
expect(responseBody.data.weekStart).toEqual(user.weekStart);
Expand All @@ -117,6 +119,8 @@ describe("Me Endpoints", () => {

expect(responseBody.data.id).toEqual(user.id);
expect(responseBody.data.email).toEqual(user.email);
expect(responseBody.data.avatarUrl).toEqual(user.avatarUrl);
expect(responseBody.data.bio).toEqual(user.bio);
expect(responseBody.data.timeFormat).toEqual(user.timeFormat);
expect(responseBody.data.defaultScheduleId).toEqual(user.defaultScheduleId);
expect(responseBody.data.weekStart).toEqual(user.weekStart);
Expand Down Expand Up @@ -151,13 +155,13 @@ describe("Me Endpoints", () => {
});

it("should not update user associated with access token given invalid time format", async () => {
const bodyWithIncorrectTimeFormat: UpdateManagedUserInput = { timeFormat: 100 as any };
const bodyWithIncorrectTimeFormat = { timeFormat: 100 };

return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectTimeFormat).expect(400);
});

it("should not update user associated with access token given invalid week start", async () => {
const bodyWithIncorrectWeekStart: UpdateManagedUserInput = { weekStart: "waba luba dub dub" as any };
const bodyWithIncorrectWeekStart = { weekStart: "waba luba dub dub" };

return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectWeekStart).expect(400);
});
Expand Down
8 changes: 8 additions & 0 deletions apps/api/v2/src/ee/me/outputs/me.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export class MeOutput {
@DocsProperty({ type: String, nullable: true })
name!: string | null;

@IsString()
@DocsProperty({ type: String, nullable: true })
avatarUrl!: string | null;

@IsString()
@DocsProperty({ type: String, nullable: true })
bio!: string | null;

@IsInt()
@DocsProperty()
timeFormat!: number;
Expand Down
2 changes: 2 additions & 0 deletions packages/platform/types/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export const userSchemaResponse = z.object({
id: z.number().int(),
email: z.string(),
name: z.string().nullable(),
avatarUrl: z.string().nullable(),
bio: z.string().nullable(),
timeFormat: z.number().int().default(12),
defaultScheduleId: z.number().int().nullable(),
weekStart: z.string(),
Expand Down
Loading