UserPermission and GroupPermission models (#5860)
* 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
This commit is contained in:
@@ -18,8 +18,8 @@ import {
|
||||
Revision,
|
||||
View,
|
||||
Share,
|
||||
CollectionUser,
|
||||
CollectionGroup,
|
||||
UserPermission,
|
||||
GroupPermission,
|
||||
GroupUser,
|
||||
Comment,
|
||||
} from "@server/models";
|
||||
@@ -426,7 +426,7 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
|
||||
subscription: WebhookSubscription,
|
||||
event: CollectionUserEvent
|
||||
): Promise<void> {
|
||||
const model = await CollectionUser.scope([
|
||||
const model = await UserPermission.scope([
|
||||
"withUser",
|
||||
"withCollection",
|
||||
]).findOne({
|
||||
@@ -443,7 +443,7 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
|
||||
payload: {
|
||||
id: `${event.userId}-${event.collectionId}`,
|
||||
model: model && presentMembership(model),
|
||||
collection: model && presentCollection(model.collection),
|
||||
collection: model && presentCollection(model.collection!),
|
||||
user: model && presentUser(model.user),
|
||||
},
|
||||
});
|
||||
@@ -453,7 +453,7 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
|
||||
subscription: WebhookSubscription,
|
||||
event: CollectionGroupEvent
|
||||
): Promise<void> {
|
||||
const model = await CollectionGroup.scope([
|
||||
const model = await GroupPermission.scope([
|
||||
"withGroup",
|
||||
"withCollection",
|
||||
]).findOne({
|
||||
@@ -470,7 +470,7 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
|
||||
payload: {
|
||||
id: `${event.modelId}-${event.collectionId}`,
|
||||
model: model && presentCollectionGroupMembership(model),
|
||||
collection: model && presentCollection(model.collection),
|
||||
collection: model && presentCollection(model.collection!),
|
||||
group: model && presentGroup(model.group),
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user