chore: update api v2 /me endpoint (#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>
This commit is contained in:
co-authored by
Anik Dhabal Babu
parent
6d621e0b60
commit
eae779b81c
@@ -30,6 +30,7 @@ describe("Me Endpoints", () => {
|
||||
let profilesRepositoryFixture: ProfileRepositoryFixture;
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
const userEmail = `me-controller-user-${randomString()}@api.com`;
|
||||
const name = "Me Controller User";
|
||||
let user: User;
|
||||
let org: Team;
|
||||
|
||||
@@ -55,6 +56,7 @@ describe("Me Endpoints", () => {
|
||||
user = await userRepositoryFixture.create({
|
||||
email: userEmail,
|
||||
username: userEmail,
|
||||
name,
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
@@ -92,6 +94,7 @@ 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.timeFormat).toEqual(user.timeFormat);
|
||||
expect(responseBody.data.defaultScheduleId).toEqual(user.defaultScheduleId);
|
||||
expect(responseBody.data.weekStart).toEqual(user.weekStart);
|
||||
|
||||
@@ -23,6 +23,10 @@ export class MeOutput {
|
||||
@DocsProperty()
|
||||
email!: string;
|
||||
|
||||
@IsString()
|
||||
@DocsProperty({ type: String, nullable: true })
|
||||
name!: string | null;
|
||||
|
||||
@IsInt()
|
||||
@DocsProperty()
|
||||
timeFormat!: number;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { z } from "zod";
|
||||
export const userSchemaResponse = z.object({
|
||||
id: z.number().int(),
|
||||
email: z.string(),
|
||||
name: z.string().nullable(),
|
||||
timeFormat: z.number().int().default(12),
|
||||
defaultScheduleId: z.number().int().nullable(),
|
||||
weekStart: z.string(),
|
||||
|
||||
Reference in New Issue
Block a user