Skip to content

Commit eae779b

Browse files
chore: update api v2 /me endpoint (calcom#23984)
* fix: update profile me ednpoint to include name of user * fix: update user schema * pass name for user * implement PR feedback * chore: implement PR feedback --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
1 parent 6d621e0 commit eae779b

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

apps/api/v2/src/ee/me/me.controller.e2e-spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe("Me Endpoints", () => {
3030
let profilesRepositoryFixture: ProfileRepositoryFixture;
3131
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
3232
const userEmail = `me-controller-user-${randomString()}@api.com`;
33+
const name = "Me Controller User";
3334
let user: User;
3435
let org: Team;
3536

@@ -55,6 +56,7 @@ describe("Me Endpoints", () => {
5556
user = await userRepositoryFixture.create({
5657
email: userEmail,
5758
username: userEmail,
59+
name,
5860
});
5961

6062
org = await organizationsRepositoryFixture.create({
@@ -92,6 +94,7 @@ describe("Me Endpoints", () => {
9294

9395
expect(responseBody.data.id).toEqual(user.id);
9496
expect(responseBody.data.email).toEqual(user.email);
97+
expect(responseBody.data.name).toEqual(user.name);
9598
expect(responseBody.data.timeFormat).toEqual(user.timeFormat);
9699
expect(responseBody.data.defaultScheduleId).toEqual(user.defaultScheduleId);
97100
expect(responseBody.data.weekStart).toEqual(user.weekStart);

apps/api/v2/src/ee/me/outputs/me.output.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export class MeOutput {
2323
@DocsProperty()
2424
email!: string;
2525

26+
@IsString()
27+
@DocsProperty({ type: String, nullable: true })
28+
name!: string | null;
29+
2630
@IsInt()
2731
@DocsProperty()
2832
timeFormat!: number;

packages/platform/types/me.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { z } from "zod";
33
export const userSchemaResponse = z.object({
44
id: z.number().int(),
55
email: z.string(),
6+
name: z.string().nullable(),
67
timeFormat: z.number().int().default(12),
78
defaultScheduleId: z.number().int().nullable(),
89
weekStart: z.string(),

0 commit comments

Comments
 (0)