refactor(server): rename tx to db (#9867)

This commit is contained in:
fengmk2
2025-01-23 07:52:45 +00:00
parent 6ac6a8d6d6
commit 2088b760bf
7 changed files with 32 additions and 34 deletions

View File

@@ -9,7 +9,7 @@ export class WorkspaceFeatureModel extends BaseModel {
async get<T extends WorkspaceFeatureName>(workspaceId: string, name: T) {
const feature = await this.models.feature.get_unchecked(name);
const workspaceFeature = await this.tx.workspaceFeature.findFirst({
const workspaceFeature = await this.db.workspaceFeature.findFirst({
where: {
workspaceId,
featureId: feature.id,
@@ -69,7 +69,7 @@ export class WorkspaceFeatureModel extends BaseModel {
) {
const feature = await this.models.feature.get_unchecked(featureName);
const existing = await this.tx.workspaceFeature.findFirst({
const existing = await this.db.workspaceFeature.findFirst({
where: {
workspaceId,
featureId: feature.id,
@@ -99,7 +99,7 @@ export class WorkspaceFeatureModel extends BaseModel {
let workspaceFeature;
if (existing) {
workspaceFeature = await this.tx.workspaceFeature.update({
workspaceFeature = await this.db.workspaceFeature.update({
where: {
id: existing.id,
},
@@ -109,7 +109,7 @@ export class WorkspaceFeatureModel extends BaseModel {
},
});
} else {
workspaceFeature = await this.tx.workspaceFeature.create({
workspaceFeature = await this.db.workspaceFeature.create({
data: {
workspaceId,
featureId: feature.id,
@@ -130,7 +130,7 @@ export class WorkspaceFeatureModel extends BaseModel {
async remove(workspaceId: string, featureName: WorkspaceFeatureName) {
const feature = await this.models.feature.get_unchecked(featureName);
await this.tx.workspaceFeature.deleteMany({
await this.db.workspaceFeature.deleteMany({
where: {
workspaceId,
featureId: feature.id,