refactor(server): folder structure (#5573)

This commit is contained in:
liuyi
2024-01-12 04:18:39 +00:00
parent d6f65ea414
commit 89b5c96d25
113 changed files with 453 additions and 482 deletions

View File

@@ -4,7 +4,7 @@ import { Logger, Module } from '@nestjs/common';
import { CommandFactory } from 'nest-commander';
import { AppModule as BusinessAppModule } from '../app';
import { ConfigModule } from '../config';
import { ConfigModule } from '../fundamentals/config';
import { CreateCommand, NameQuestion } from './commands/create';
import { RevertCommand, RunCommand } from './commands/run';
@@ -16,9 +16,6 @@ import { RevertCommand, RunCommand } from './commands/run';
enableUpdateAutoMerging: false,
},
},
metrics: {
enabled: false,
},
}),
BusinessAppModule,
],

View File

@@ -4,15 +4,14 @@ import { fileURLToPath } from 'node:url';
import { Logger } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { PrismaClient } from '@prisma/client';
import { Command, CommandRunner } from 'nest-commander';
import { PrismaService } from '../../prisma';
interface Migration {
file: string;
name: string;
up: (db: PrismaService, injector: ModuleRef) => Promise<void>;
down: (db: PrismaService, injector: ModuleRef) => Promise<void>;
up: (db: PrismaClient, injector: ModuleRef) => Promise<void>;
down: (db: PrismaClient, injector: ModuleRef) => Promise<void>;
}
export async function collectMigrations(): Promise<Migration[]> {
@@ -48,7 +47,7 @@ export async function collectMigrations(): Promise<Migration[]> {
export class RunCommand extends CommandRunner {
logger = new Logger(RunCommand.name);
constructor(
private readonly db: PrismaService,
private readonly db: PrismaClient,
private readonly injector: ModuleRef
) {
super();
@@ -139,7 +138,7 @@ export class RevertCommand extends CommandRunner {
logger = new Logger(RevertCommand.name);
constructor(
private readonly db: PrismaService,
private readonly db: PrismaClient,
private readonly injector: ModuleRef
) {
super();

View File

@@ -1,7 +1,7 @@
import { PrismaClient } from '@prisma/client';
import { applyUpdate, Doc, encodeStateAsUpdate } from 'yjs';
import { DocID } from '../../utils/doc';
import { DocID } from '../../modules/utils/doc';
export class Guid1698398506533 {
// do the migration