2023-03-13 12:08:02 -07:00
|
|
|
import z from 'zod';
|
|
|
|
|
2023-03-15 11:53:17 -07:00
|
|
|
import { accountSchema } from './account';
|
|
|
|
|
2023-03-13 12:08:02 -07:00
|
|
|
enum TruthSocialGroupRoles {
|
|
|
|
ADMIN = 'owner',
|
|
|
|
MODERATOR = 'admin',
|
|
|
|
USER = 'user'
|
|
|
|
}
|
|
|
|
|
|
|
|
enum BaseGroupRoles {
|
|
|
|
ADMIN = 'admin',
|
|
|
|
MODERATOR = 'moderator',
|
|
|
|
USER = 'user'
|
|
|
|
}
|
|
|
|
|
|
|
|
const groupMemberSchema = z.object({
|
|
|
|
id: z.string(),
|
2023-03-15 11:53:17 -07:00
|
|
|
account: accountSchema,
|
2023-03-13 12:08:02 -07:00
|
|
|
role: z.union([
|
|
|
|
z.nativeEnum(TruthSocialGroupRoles),
|
|
|
|
z.nativeEnum(BaseGroupRoles),
|
|
|
|
]),
|
|
|
|
});
|
|
|
|
|
|
|
|
type GroupMember = z.infer<typeof groupMemberSchema>;
|
|
|
|
|
|
|
|
export { groupMemberSchema, GroupMember };
|