feat: refresh new workspace feature (#5834)

This commit is contained in:
DarkSky
2024-02-19 21:58:54 +08:00
committed by GitHub
parent 1ceaf87a86
commit d665eaec34
2 changed files with 26 additions and 0 deletions
@@ -3,6 +3,7 @@ import { Prisma, PrismaClient } from '@prisma/client';
import {
CommonFeature,
FeatureKind,
Features,
FeatureType,
} from '../../../core/features';
@@ -33,6 +34,16 @@ export async function upsertFeature(
}
}
export async function upsertLatestFeatureVersion(
db: PrismaClient,
type: FeatureType
) {
const feature = Features.filter(f => f.feature === type);
feature.sort((a, b) => b.version - a.version);
const latestFeature = feature[0];
await upsertFeature(db, latestFeature);
}
export async function migrateNewFeatureTable(prisma: PrismaClient) {
const waitingList = await prisma.newFeaturesWaitingList.findMany();
for (const oldUser of waitingList) {