refactor(server): saving past_due subscription in db (#10908)

close CLOUD-122
This commit is contained in:
forehalo
2025-03-17 10:17:14 +00:00
parent 9b5d12dc71
commit 8b67496951
5 changed files with 65 additions and 43 deletions

View File

@@ -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()

View File

@@ -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}`
);
}
}
}