* fix: rename to group_permissions * fix: delete null collectionId records before setting non null constraint * fix: use scope with collectionId not null * fix: update model with documentId * fix: rename to GroupPermission * fix: rename collection_users to user_permissions * fix: teamPermanentDeleter test * fix: use scope with collectionId not null * fix: update model with documentId * fix: rename to UserPermission * fix: create views upon table rename for zero downtime * fix: remove comments
21 lines
506 B
TypeScript
21 lines
506 B
TypeScript
import { CollectionPermission } from "@shared/types";
|
|
import { UserPermission } from "@server/models";
|
|
|
|
type Membership = {
|
|
id: string;
|
|
userId: string;
|
|
collectionId?: string | null;
|
|
permission: CollectionPermission;
|
|
};
|
|
|
|
export default function presentMembership(
|
|
membership: UserPermission
|
|
): Membership {
|
|
return {
|
|
id: `${membership.userId}-${membership.collectionId}`,
|
|
userId: membership.userId,
|
|
collectionId: membership.collectionId,
|
|
permission: membership.permission,
|
|
};
|
|
}
|