feat: add avatarUrl and bio fields to /me endpoint response (#25224)
* feat: add avatarUrl to /v2/me endpoint response - Add avatarUrl field to userSchemaResponse schema in packages/platform/types/me.ts - Update e2e tests to verify avatarUrl is returned in GET and PATCH /v2/me responses - Field is nullable to match User model in Prisma schema - Fix pre-existing lint warnings by removing 'as any' type assertions in test file Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com> * feat: add avatarUrl to MeOutput DTO for OpenAPI docs - Add avatarUrl field to MeOutput class in apps/api/v2/src/ee/me/outputs/me.output.ts - Field is nullable to match the Zod schema and Prisma model - This ensures OpenAPI documentation will include avatarUrl when regenerated Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com> * feat: add bio field to /v2/me endpoint response - Add bio field to userSchemaResponse Zod schema in packages/platform/types/me.ts - Add bio field to MeOutput NestJS DTO in apps/api/v2/src/ee/me/outputs/me.output.ts - Update e2e tests to verify bio is returned in both GET and PATCH responses - Field is nullable to match the User model in Prisma schema Co-Authored-By: rajiv@cal.com <sahalrajiv6900@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: chauhan_s <somaychauhan98@gmail.com>
This commit is contained in:
co-authored by
rajiv@cal.com <sahalrajiv6900@gmail.com>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
chauhan_s
parent
68d3d9d964
commit
1dcd54aab7
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user