Files
outline/server/routes/api/users/schema.ts
Apoorv Mishra 20d85e3d3a Allow admin to change member's name (#5233)
* feat: allow admins to change user names

* fix: review
2023-04-22 20:48:51 +05:30

36 lines
1003 B
TypeScript

import { z } from "zod";
import { NotificationEventType, UserPreference } from "@shared/types";
import BaseSchema from "../BaseSchema";
export const UsersNotificationsSubscribeSchema = z.object({
body: z.object({
eventType: z.nativeEnum(NotificationEventType),
}),
});
export type UsersNotificationsSubscribeReq = z.infer<
typeof UsersNotificationsSubscribeSchema
>;
export const UsersNotificationsUnsubscribeSchema = z.object({
body: z.object({
eventType: z.nativeEnum(NotificationEventType),
}),
});
export type UsersNotificationsUnsubscribeReq = z.infer<
typeof UsersNotificationsUnsubscribeSchema
>;
export const UsersUpdateSchema = BaseSchema.extend({
body: z.object({
id: z.string().uuid().optional(),
name: z.string().optional(),
avatarUrl: z.string().optional(),
language: z.string().optional(),
preferences: z.record(z.nativeEnum(UserPreference), z.boolean()).optional(),
}),
});
export type UsersUpdateReq = z.infer<typeof UsersUpdateSchema>;