Skip to content

Commit

Permalink
feat: remove mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 15, 2024
1 parent ed45726 commit 1670c1c
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 717 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ SYSTEM_QUESTION_LINK=
#-----------------------Backend Config------------------------------#
# DB Config
DATABASE_URL=postgress://canyon:canyon@localhost:5432/canyon
MONGODB_URL=mongodb://xxxxx

# Gitlab Auth Config
GITLAB_URL="https://gitlab.com"
Expand Down
4 changes: 4 additions & 0 deletions packages/canyon-backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
8 changes: 1 addition & 7 deletions packages/canyon-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canyon-backend",
"version": "0.0.2",
"version": "0.0.1",
"description": "",
"private": true,
"scripts": {
Expand All @@ -11,14 +11,12 @@
},
"dependencies": {
"@canyon/data": "workspace:^",
"@mongodb-js/zstd": "^1.2.0",
"@nestjs/apollo": "^12.1.0",
"@nestjs/common": "^10.3.9",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.3.9",
"@nestjs/graphql": "^12.1.1",
"@nestjs/jwt": "^10.2.0",
"@nestjs/mongoose": "^10.0.6",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.9",
"@nestjs/schedule": "^4.0.2",
Expand All @@ -28,7 +26,6 @@
"axios": "^1.7.2",
"better-sqlite3": "^9.6.0",
"body-parser": "^1.20.2",
"camaro": "^6.2.3",
"canyon-data": "^0.1.1-alpha.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
Expand All @@ -38,14 +35,11 @@
"dotenv": "^16.4.5",
"express": "^4.19.2",
"graphql": "^16.9.0",
"graphql-query-complexity": "^0.12.0",
"graphql-subscriptions": "^2.0.0",
"istanbul-lib-coverage": "^3.2.2",
"istanbul-lib-report": "^3.0.1",
"istanbul-lib-source-maps": "^4.0.1",
"istanbul-reports": "^3.1.7",
"lodash": "^4.17.21",
"mongoose": "^8.4.4",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"prisma": "^5.16.1",
Expand Down
59 changes: 25 additions & 34 deletions packages/canyon-backend/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
// import { ConfigModule } from '@nestjs/config';
import { PrismaModule } from './prisma/prisma.module';
import { CoverageModule } from './coverage/coverage.module';
import { ScheduleModule } from '@nestjs/schedule';
import { AuthModule } from './auth/auth.module';
import { UserModule } from './user/user.module';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
import { ProjectModule } from './project/project.module';
import { CodechangeModule } from './codechange/codechange.module';
import { SourcecodeController } from './sourcecode/sourcecode.controller';
import { SourcecodeService } from './sourcecode/sourcecode.service';
import { SourcecodeModule } from './sourcecode/sourcecode.module';
import { join } from 'path';
import { ServeStaticModule } from '@nestjs/serve-static';
import { UploadModule } from './upload/upload.module';
import { MongooseModule } from '@nestjs/mongoose';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CoveragediskEntity } from './coverage/entity/coveragedisk.entity';
import {TaskModule} from "./task/task.module";
// import * as path from 'node:path';
import { Module } from "@nestjs/common";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { PrismaModule } from "./prisma/prisma.module";
import { CoverageModule } from "./coverage/coverage.module";
import { ScheduleModule } from "@nestjs/schedule";
import { AuthModule } from "./auth/auth.module";
import { UserModule } from "./user/user.module";
import { GraphQLModule } from "@nestjs/graphql";
import { ApolloDriver, ApolloDriverConfig } from "@nestjs/apollo";
import { ProjectModule } from "./project/project.module";
import { CodechangeModule } from "./codechange/codechange.module";
import { SourcecodeController } from "./sourcecode/sourcecode.controller";
import { SourcecodeService } from "./sourcecode/sourcecode.service";
import { SourcecodeModule } from "./sourcecode/sourcecode.module";
import { join } from "path";
import { ServeStaticModule } from "@nestjs/serve-static";
import { UploadModule } from "./upload/upload.module";
import { TypeOrmModule } from "@nestjs/typeorm";
import { CoveragediskEntity } from "./coverage/entity/coveragedisk.entity";

@Module({
imports: [
// ConfigModule.forRoot({
// envFilePath: path.resolve(__dirname, '../../../.env'),
// }),
MongooseModule.forRoot(process.env.MONGODB_URL),
TypeOrmModule.forRoot({
type: 'better-sqlite3',
database: 'db/sql',
type: "better-sqlite3",
database: "db/sql",
synchronize: true,
entities: [CoveragediskEntity],
}),
Expand All @@ -44,13 +36,12 @@ import {TaskModule} from "./task/task.module";
CodechangeModule,
SourcecodeModule,
UploadModule,
TaskModule,
ServeStaticModule.forRoot({
rootPath: join(__dirname, '../../canyon-platform', 'dist'),
exclude: ['/graphql/(.*)'],
rootPath: join(__dirname, "../../canyon-platform", "dist"),
exclude: ["/graphql/(.*)"],
}),
GraphQLModule.forRoot<ApolloDriverConfig>({
autoSchemaFile: 'schema.gql',
autoSchemaFile: "schema.gql",
driver: ApolloDriver,
}),
],
Expand Down
54 changes: 16 additions & 38 deletions packages/canyon-backend/src/coverage/coverage.module.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,32 @@
import { Module } from '@nestjs/common';
import { RetrieveCoverageTreeSummaryService } from './services/retrieve-coverage-tree-summary.service';
import { CoverageClientService } from './services/coverage-client.service';
import { PrismaService } from '../prisma/prisma.service';
import { CoverageController } from './coverage.controller';
import { CoverageService } from './services/coverage.service';
import { MongooseModule } from '@nestjs/mongoose';
import {
CoverageData,
CoverageDataSchema,
} from './schemas/coverage-data.schema';
import { CoverageDataAdapterService } from './services/common/coverage-data-adapter.service';
import { ConsumerCoverageService } from './services/core/consumer-coverage.service';
import { PullChangeCodeAndInsertDbService } from './services/common/pull-change-code-and-insert-db.service';
import { CoverageLog, CoverageLogSchema } from './schemas/coverage-log.schema';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CoveragediskEntity } from './entity/coveragedisk.entity';
import { CoveragediskService } from './services/core/coveragedisk.service';
import { TestExcludeService } from './services/common/test-exclude.service';
import { PullFilePathAndInsertDbService } from './services/common/pull-file-path-and-insert-db.service';
import {CoverageReportsService} from "./services/coverage-reports.service";
import { Module } from "@nestjs/common";
import { RetrieveCoverageTreeSummaryService } from "./services/retrieve-coverage-tree-summary.service";
import { CoverageClientService } from "./services/coverage-client.service";
import { PrismaService } from "../prisma/prisma.service";
import { CoverageController } from "./coverage.controller";
import { CoverageService } from "./services/coverage.service";
import { ConsumerCoverageService } from "./services/core/consumer-coverage.service";
import { PullChangeCodeAndInsertDbService } from "./services/common/pull-change-code-and-insert-db.service";
import { TypeOrmModule } from "@nestjs/typeorm";
import { CoveragediskEntity } from "./entity/coveragedisk.entity";
import { CoveragediskService } from "./services/core/coveragedisk.service";
import { TestExcludeService } from "./services/common/test-exclude.service";
import { PullFilePathAndInsertDbService } from "./services/common/pull-file-path-and-insert-db.service";
import { CoverageReportsService } from "./services/coverage-reports.service";

@Module({
imports: [
MongooseModule.forFeature([
{
name: CoverageData.name,
schema: CoverageDataSchema,
collection: 'canyon_coverage_data',
},
{
name: CoverageLog.name,
schema: CoverageLogSchema,
collection: 'canyon_coverage_log',
}
]),
TypeOrmModule.forFeature([CoveragediskEntity]),
],
imports: [TypeOrmModule.forFeature([CoveragediskEntity])],
controllers: [CoverageController],
providers: [
PrismaService,
CoverageClientService,
RetrieveCoverageTreeSummaryService,
CoverageService,
CoverageDataAdapterService,
ConsumerCoverageService,
PullChangeCodeAndInsertDbService,
PullFilePathAndInsertDbService,
CoveragediskService,
TestExcludeService,
CoverageReportsService
CoverageReportsService,
],
})
export class CoverageModule {}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1670c1c

Please sign in to comment.