2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
import { accountSchema } from './account';
|
|
|
|
|
|
|
|
enum GroupRoles {
|
|
|
|
OWNER = 'owner',
|
|
|
|
ADMIN = 'admin',
|
|
|
|
USER = 'user'
|
|
|
|
}
|
|
|
|
|
2024-11-29 09:11:34 -08:00
|
|
|
/**
|
|
|
|
* @category Entity types
|
|
|
|
*/
|
2024-08-28 04:43:23 -07:00
|
|
|
type GroupRole =`${GroupRoles}`;
|
|
|
|
|
2024-10-29 14:44:28 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const groupMemberSchema = v.object({
|
|
|
|
id: v.string(),
|
2024-08-28 04:43:23 -07:00
|
|
|
account: accountSchema,
|
2024-10-15 16:08:56 -07:00
|
|
|
role: v.enum(GroupRoles),
|
2024-08-28 04:43:23 -07:00
|
|
|
});
|
|
|
|
|
2024-11-29 07:01:54 -08:00
|
|
|
/**
|
|
|
|
* @category Entity types
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
type GroupMember = v.InferOutput<typeof groupMemberSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-12-05 01:49:43 -08:00
|
|
|
export { groupMemberSchema, type GroupMember, type GroupRoles, type GroupRole };
|