mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
refactor(server): saving past_due subscription in db (#10908)
close CLOUD-122
This commit is contained in:
@@ -107,7 +107,7 @@ export class UserFeatureModel extends BaseModel {
|
||||
}
|
||||
|
||||
async remove(userId: string, featureName: UserFeatureName) {
|
||||
await this.db.userFeature.updateMany({
|
||||
const { count } = await this.db.userFeature.updateMany({
|
||||
where: {
|
||||
userId,
|
||||
name: featureName,
|
||||
@@ -117,9 +117,11 @@ export class UserFeatureModel extends BaseModel {
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.verbose(
|
||||
`Feature ${featureName} deactivated for user ${userId}`
|
||||
);
|
||||
if (count > 0) {
|
||||
this.logger.verbose(
|
||||
`Feature ${featureName} deactivated for user ${userId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional()
|
||||
|
||||
@@ -194,15 +194,17 @@ export class WorkspaceFeatureModel extends BaseModel {
|
||||
}
|
||||
|
||||
async remove(workspaceId: string, featureName: WorkspaceFeatureName) {
|
||||
await this.db.workspaceFeature.deleteMany({
|
||||
const { count } = await this.db.workspaceFeature.deleteMany({
|
||||
where: {
|
||||
workspaceId,
|
||||
name: featureName,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.verbose(
|
||||
`Feature ${featureName} removed from workspace ${workspaceId}`
|
||||
);
|
||||
if (count > 0) {
|
||||
this.logger.verbose(
|
||||
`Feature ${featureName} removed from workspace ${workspaceId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user