2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
import { GroupRoles } from './group-member';
|
|
|
|
|
2024-10-29 14:44:28 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const groupRelationshipSchema = v.object({
|
|
|
|
id: v.string(),
|
|
|
|
member: v.fallback(v.boolean(), false),
|
2024-10-15 16:08:56 -07:00
|
|
|
role: v.fallback(v.enum(GroupRoles), GroupRoles.USER),
|
2024-10-13 15:25:30 -07:00
|
|
|
requested: v.fallback(v.boolean(), false),
|
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 GroupRelationship = v.InferOutput<typeof groupRelationshipSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { groupRelationshipSchema, type GroupRelationship };
|