Skip to content

Commit 692225c

Browse files
committed
chore: remove sqlite
1 parent 9572d1a commit 692225c

File tree

18 files changed

+139
-663
lines changed

18 files changed

+139
-663
lines changed

apps/backend-mock/nest-cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"collection": "@nestjs/schematics",
44
"sourceRoot": "src",
55
"compilerOptions": {
6-
"assets": ["**/*.yml"],
6+
"assets": ["**/*.yml", "**/*.json"],
77
"watchAssets": true,
88
"deleteOutDir": true
99
}

apps/backend-mock/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"@nestjs/jwt": "^10.2.0",
2020
"@nestjs/passport": "^10.0.3",
2121
"@nestjs/platform-express": "^10.3.10",
22-
"@nestjs/typeorm": "^10.0.2",
2322
"@types/js-yaml": "^4.0.9",
2423
"bcryptjs": "^2.4.3",
2524
"class-transformer": "^0.5.1",
@@ -31,9 +30,7 @@
3130
"passport-jwt": "^4.0.1",
3231
"passport-local": "^1.0.0",
3332
"reflect-metadata": "^0.2.2",
34-
"rxjs": "^7.8.1",
35-
"sqlite3": "^5.1.7",
36-
"typeorm": "^0.3.20"
33+
"rxjs": "^7.8.1"
3734
},
3835
"devDependencies": {
3936
"@nestjs/cli": "^10.4.0",

apps/backend-mock/src/app.module.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
import configuration from '@/config/index';
22
import { Module } from '@nestjs/common';
33
import { ConfigModule } from '@nestjs/config';
4-
import { TypeOrmModule } from '@nestjs/typeorm';
54
import Joi from 'joi';
65

76
import { AuthModule } from './modules/auth/auth.module';
8-
import { DatabaseModule } from './modules/database/database.module';
97
import { HealthModule } from './modules/health/health.module';
108
import { MenuModule } from './modules/menu/menu.module';
9+
import { MockModule } from './modules/mock/mock.module';
1110
import { UsersModule } from './modules/users/users.module';
1211

1312
@Module({
1413
imports: [
15-
TypeOrmModule.forRoot({
16-
autoLoadEntities: true,
17-
database: 'data/db.sqlite',
18-
synchronize: true,
19-
type: 'sqlite',
20-
}),
2114
ConfigModule.forRoot({
2215
cache: true,
2316
isGlobal: true,
@@ -34,8 +27,8 @@ import { UsersModule } from './modules/users/users.module';
3427
HealthModule,
3528
AuthModule,
3629
UsersModule,
37-
DatabaseModule,
3830
MenuModule,
31+
MockModule,
3932
],
4033
})
4134
export class AppModule {}

apps/backend-mock/src/models/entity/user.entity.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
1-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
2-
3-
@Entity()
41
class UserEntity {
5-
@PrimaryGeneratedColumn()
62
id: number;
73
/**
84
* 密码
95
*/
10-
@Column()
116
password: string;
127
/**
138
* 真实姓名
149
*/
15-
@Column()
1610
realName: string;
1711
/**
1812
* 角色
1913
*/
20-
@Column('text', {
21-
transformer: {
22-
from: (value: string) => JSON.parse(value),
23-
to: (value: string[]) => JSON.stringify(value),
24-
},
25-
})
2614
roles: string[];
2715
/**
2816
* 用户名
2917
*/
30-
@Column({ unique: true })
3118
username: string;
3219
}
3320

apps/backend-mock/src/modules/database/database.module.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

apps/backend-mock/src/modules/database/database.service.spec.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

apps/backend-mock/src/modules/database/database.service.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
interface User {
2+
id: number;
3+
password: string;
4+
realName: string;
5+
roles: string[];
6+
username: string;
7+
}
8+
9+
interface MockDatabaseData {
10+
users: User[];
11+
}
12+
13+
export type { MockDatabaseData, User };
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Module } from '@nestjs/common';
2+
3+
import { MockService } from './mock.service';
4+
5+
@Module({
6+
exports: [MockService],
7+
providers: [MockService],
8+
})
9+
export class MockModule {}

0 commit comments

Comments
 (0)