a.e. 07cc849877
refactor: team permission manager (#3535)
* perf: classify org, group and member

* refactor: team per manager

* fix: missing functions
2025-01-07 09:19:23 +08:00

60 lines
1.2 KiB
TypeScript

import { RequireAtLeastOne, RequireOnlyOne } from '../../common/type/utils';
import { Permission } from './controller';
import { PermissionValueType } from './type';
export type CollaboratorItemType = {
teamId: string;
permission: Permission;
name: string;
avatar: string;
} & RequireOnlyOne<{
tmbId: string;
groupId: string;
orgId: string;
}>;
export type UpdateClbPermissionProps = {
members?: string[];
groups?: string[];
orgs?: string[];
permission: PermissionValueType;
};
export type DeleteClbPermissionProps = RequireOnlyOne<{
tmbId: string;
groupId: string;
orgId: string;
}>;
export type UpdatePermissionBody = {
permission: PermissionValueType;
} & RequireOnlyOne<{
memberId: string;
groupId: string;
orgId: string;
}>;
export type CreatePermissionBody = {
tmbId: string[];
groupId: string[];
orgId: string[];
};
export type DeletePermissionQuery = RequireOnlyOne<{
tmbId?: string;
groupId?: string;
orgId?: string;
}>;
export type TeamClbsListType = {
permission: number;
name: string;
avatar: string;
};
export type ListPermissionResponse = {
tmb: (TeamClbsListType & { tmbId: string })[];
group: (TeamClbsListType & { groupId: string })[];
org: (TeamClbsListType & { orgId: string })[];
};