-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from Shpendiiiii/main
Fixed #20
- Loading branch information
Showing
25 changed files
with
329 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports= { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'prettier/prettier': 0, | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserModule } from './user/user.module'; | ||
import { ObjectModule } from './object/object.module'; | ||
import { TypeModule } from './type/type.module'; | ||
import { PrismaModule } from './prisma/prisma.module'; | ||
import { UserService } from './user/user.service'; | ||
import { TypeService } from './type/type.service'; | ||
import { UserController } from './user/user.controller'; | ||
import { TypeController } from './type/type.controller'; | ||
import { ConfigModule } from '@nestjs/config'; | ||
import { ObjectModule } from './object/object.module'; | ||
import { ObjectController } from './object/object.controller'; | ||
import { ObjectService } from './object/object.service'; | ||
|
||
@Module({ | ||
imports: [ | ||
ObjectModule, | ||
ConfigModule.forRoot({ isGlobal: true }), | ||
TypeModule, | ||
UserModule, | ||
PrismaModule | ||
ObjectModule, | ||
PrismaModule, | ||
], | ||
controllers: [], | ||
providers: [], | ||
controllers: [UserController, TypeController, ObjectController], | ||
providers: [UserService, TypeService, ObjectService], | ||
}) | ||
export class AppModule {} | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import { Logger } from '@nestjs/common'; | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
import { setupSwagger } from '../../../libs/utils/swagger'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
const port = process.env.PORT || 3006; | ||
if (process.env.NODE_ENV !== 'production') { | ||
setupSwagger(app); | ||
} | ||
await app.listen(port); | ||
Logger.log( | ||
`🚀 Application is running on: http://localhost:${port}` | ||
); | ||
Logger.log(`🚀 Application is running on: http://localhost:${port}`); | ||
} | ||
|
||
bootstrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class ObjectService { | ||
|
||
} | ||
export class ObjectService {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { PrismaClient } from '@prisma/client'; | ||
|
||
@Injectable() | ||
export class PrismaService extends PrismaClient{} | ||
export class PrismaService extends PrismaClient { | ||
constructor(config: ConfigService) { | ||
super({ | ||
datasources: { | ||
db: { | ||
url: config.get('DATABASE_URL'), | ||
}, | ||
}, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class TypeService { | ||
|
||
|
||
|
||
} | ||
export class TypeService {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,34 @@ | ||
import { Body, Controller, Post, Get, Param, ParseIntPipe, ValidationPipe } from '@nestjs/common'; | ||
import { | ||
Body, | ||
Controller, | ||
Post, | ||
Get, | ||
Param, | ||
ParseIntPipe, | ||
ValidationPipe | ||
} from '@nestjs/common'; | ||
import { UserService } from './user.service'; | ||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; | ||
|
||
@Controller('users') | ||
@Controller('user') | ||
@ApiTags('user') | ||
export class UserController { | ||
constructor( ) {} | ||
constructor(private userService: UserService) { | ||
} | ||
|
||
@Get(':user_uuid/types/:type_uuid') | ||
async handleGetUserLikes(@Param('user_uuid') user_uuid: string) { | ||
return 'handleGetUserLikes'; | ||
@ApiOperation({ summary: 'Get user likes on type by user id'}) | ||
@ApiResponse({ | ||
status: 200, | ||
description: 'Successfully retrieved user activities', | ||
}) | ||
@ApiResponse({ | ||
status: 404, | ||
description: 'Not Found', | ||
}) | ||
async handleGetUserLikes(@Param('user_uuid') user_uuid: string, @Param('type_uuid') type_uuid: string) { | ||
return this.userService.getUserLikesOnType(user_uuid, type_uuid); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { UserController } from './user.controller'; | ||
import { UserService } from './user.service'; | ||
import { PrismaService } from '../prisma/prisma.service'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [UserController], | ||
providers: [UserService], | ||
providers: [UserService, PrismaService], | ||
exports: [UserService], | ||
}) | ||
export class UserModule {} |
Oops, something went wrong.