mirror of https://github.com/nocodb/nocodb
Pranav C
2 years ago
33 changed files with 226 additions and 85 deletions
@ -1,18 +1,26 @@
|
||||
import { Module } from '@nestjs/common'; |
||||
import { MiddlewareConsumer, Module, RequestMethod } from '@nestjs/common' |
||||
import { Connection } from './connection/connection'; |
||||
import { AuthModule } from './auth/auth.module'; |
||||
import { ExtractProjectIdMiddleware } from './middlewares/extract-project-id/extract-project-id.middleware' |
||||
import { UsersModule } from './users/users.module'; |
||||
import { AuthModule } from './modules/auth/auth.module'; |
||||
import { ExtractProjectIdMiddleware } from './middlewares/extract-project-id/extract-project-id.middleware'; |
||||
import { UsersModule } from './modules/users/users.module'; |
||||
import { MetaService } from './meta/meta.service'; |
||||
import { LocalStrategy } from './strategies/local.strategy'; |
||||
import { UtilsModule } from './utils/utils.module'; |
||||
import { ProjectsModule } from './projects/projects.module'; |
||||
import { UtilsModule } from './modules/utils/utils.module'; |
||||
import { ProjectsModule } from './modules/projects/projects.module'; |
||||
import { JwtStrategy } from './strategies/jwt.strategy'; |
||||
import { AuthGuard } from '@nestjs/passport'; |
||||
import { TablesModule } from './modules/tables/tables.module'; |
||||
|
||||
@Module({ |
||||
imports: [AuthModule, UsersModule, UtilsModule, ProjectsModule], |
||||
imports: [AuthModule, UsersModule, UtilsModule, ProjectsModule, TablesModule], |
||||
controllers: [], |
||||
providers: [Connection, MetaService, JwtStrategy, ExtractProjectIdMiddleware], |
||||
exports: [Connection, MetaService], |
||||
}) |
||||
export class AppModule {} |
||||
export class AppModule { |
||||
configure(consumer: MiddlewareConsumer) { |
||||
consumer |
||||
.apply(ExtractProjectIdMiddleware) |
||||
.forRoutes({ path: '*', method: RequestMethod.ALL}) |
||||
} |
||||
} |
||||
|
@ -1,5 +1,5 @@
|
||||
import { Module } from '@nestjs/common'; |
||||
import { LocalStrategy } from '../strategies/local.strategy'; |
||||
import { LocalStrategy } from '../../strategies/local.strategy'; |
||||
import { AuthService } from './auth.service'; |
||||
import { AuthController } from './auth.controller'; |
||||
import { UsersModule } from '../users/users.module'; |
@ -1,5 +1,5 @@
|
||||
import { Module } from '@nestjs/common'; |
||||
import { ExtractProjectIdMiddleware } from '../middlewares/extract-project-id/extract-project-id.middleware' |
||||
import { ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware' |
||||
import { ProjectsService } from './projects.service'; |
||||
import { ProjectsController } from './projects.controller'; |
||||
|
@ -0,0 +1,20 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing'; |
||||
import { TablesController } from './tables.controller'; |
||||
import { TablesService } from './tables.service'; |
||||
|
||||
describe('TablesController', () => { |
||||
let controller: TablesController; |
||||
|
||||
beforeEach(async () => { |
||||
const module: TestingModule = await Test.createTestingModule({ |
||||
controllers: [TablesController], |
||||
providers: [TablesService], |
||||
}).compile(); |
||||
|
||||
controller = module.get<TablesController>(TablesController); |
||||
}); |
||||
|
||||
it('should be defined', () => { |
||||
expect(controller).toBeDefined(); |
||||
}); |
||||
}); |
@ -0,0 +1,7 @@
|
||||
import { Controller } from '@nestjs/common'; |
||||
import { TablesService } from './tables.service'; |
||||
|
||||
@Controller('tables') |
||||
export class TablesController { |
||||
constructor(private readonly tablesService: TablesService) {} |
||||
} |
@ -0,0 +1,9 @@
|
||||
import { Module } from '@nestjs/common'; |
||||
import { TablesService } from './tables.service'; |
||||
import { TablesController } from './tables.controller'; |
||||
|
||||
@Module({ |
||||
controllers: [TablesController], |
||||
providers: [TablesService] |
||||
}) |
||||
export class TablesModule {} |
@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing'; |
||||
import { TablesService } from './tables.service'; |
||||
|
||||
describe('TablesService', () => { |
||||
let service: TablesService; |
||||
|
||||
beforeEach(async () => { |
||||
const module: TestingModule = await Test.createTestingModule({ |
||||
providers: [TablesService], |
||||
}).compile(); |
||||
|
||||
service = module.get<TablesService>(TablesService); |
||||
}); |
||||
|
||||
it('should be defined', () => { |
||||
expect(service).toBeDefined(); |
||||
}); |
||||
}); |
@ -0,0 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common'; |
||||
|
||||
@Injectable() |
||||
export class TablesService {} |
@ -0,0 +1,15 @@
|
||||
import { Controller, Get, Request, UseGuards } from '@nestjs/common' |
||||
import { AuthGuard } from '@nestjs/passport' |
||||
import { UsersService } from './users.service' |
||||
|
||||
@Controller() |
||||
export class UsersController { |
||||
constructor(private readonly usersService: UsersService) { |
||||
} |
||||
|
||||
@UseGuards(AuthGuard('jwt')) |
||||
@Get('/api/v1/auth/user/me') |
||||
async me(@Request() req) { |
||||
return req.user |
||||
} |
||||
} |
@ -1,6 +1,6 @@
|
||||
import { Module } from '@nestjs/common'; |
||||
import { Connection } from '../connection/connection' |
||||
import { MetaService } from '../meta/meta.service' |
||||
import { Connection } from '../../connection/connection' |
||||
import { MetaService } from '../../meta/meta.service' |
||||
import { UsersService } from './users.service'; |
||||
import { UsersController } from './users.controller'; |
||||
|
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common'; |
||||
import { MetaService, MetaTable } from '../meta/meta.service' |
||||
import { MetaService, MetaTable } from '../../meta/meta.service' |
||||
|
||||
@Injectable() |
||||
export class UsersService { |
@ -1,11 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common'; |
||||
import axios from 'axios'; |
||||
import { compareVersions, validate } from 'compare-versions'; |
||||
import { NC_ATTACHMENT_FIELD_SIZE } from '../constants'; |
||||
import { NcError } from '../helpers/catchError' |
||||
import { User } from '../models' |
||||
import NcConfigFactory from './NcConfigFactory'; |
||||
import { packageVersion } from './packageVersion'; |
||||
import { NC_ATTACHMENT_FIELD_SIZE } from '../../constants'; |
||||
import { NcError } from '../../helpers/catchError'; |
||||
import { User } from '../../models'; |
||||
import NcConfigFactory from '../../utils/NcConfigFactory'; |
||||
import { packageVersion } from '../../utils/packageVersion'; |
||||
// import { packageVersion } from '../packageVersion';
|
||||
|
||||
const versionCache = { |
@ -1,13 +0,0 @@
|
||||
import { Controller, Get } from '@nestjs/common'; |
||||
import { UsersService } from './users.service'; |
||||
|
||||
@Controller() |
||||
export class UsersController { |
||||
constructor(private readonly usersService: UsersService) {} |
||||
|
||||
@Get('/api/v1/auth/user/me') |
||||
async me() { |
||||
// return this.usersService.me();
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue