Commit 1e0e5081 authored by shahriar's avatar shahriar
Browse files

Update app.controller.ts

parent 373bbda2
import { Body, Controller, Get, Post } from '@nestjs/common'; import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { AppService } from './app.service'; import { AppService } from './app.service';
import { GetUserScore } from './dto/get-user-score'; import { GetUserScore } from './dto/get-user-score';
@Controller() @Controller()
export class AppController { export class AppController {
constructor(private readonly appService: AppService) { } constructor(private readonly appService: AppService) {}
@Get('get-comments') @Get('get-comments')
async getCommentsFromIG() { async getCommentsFromIG() {
return await this.appService.getComments(); return await this.appService.getComments();
} }
@Get('get-followers') @Get('get-followers')
async getFollowers() { async getFollowers() {
return await this.appService.getFollowers(); return await this.appService.getFollowers();
} }
@Post() @Post()
async getUserScore(@Body() getUserScoreDto: GetUserScore) { async getUserScore(@Body() getUserScoreDto: GetUserScore) {
return await this.appService.calculateUserScore(getUserScoreDto.username); return await this.appService.calculateUserScore(getUserScoreDto.username);
...@@ -25,7 +23,7 @@ export class AppController { ...@@ -25,7 +23,7 @@ export class AppController {
@Get('calculate-result') @Get('calculate-result')
async calculateResult() { async calculateResult() {
return await this.appService.getResults() return await this.appService.getResults();
} }
@Get('get-results') @Get('get-results')
...@@ -33,19 +31,18 @@ export class AppController { ...@@ -33,19 +31,18 @@ export class AppController {
return await this.appService.getFinalResults(); return await this.appService.getFinalResults();
} }
@Post('search') @Get('search/:id')
async getUserResults(@Body('username') username: string) { async getUserResults(@Param('id') id: string) {
return await this.appService.getUserResult(username); return await this.appService.getUserResult(id);
} }
@Get('shuffle') @Get('shuffle')
async shuffle() { async shuffle() {
return await this.appService.getShuffleData() return await this.appService.getShuffleData();
} }
@Get('add-lottory-result') @Get('add-lottory-result')
async addResultDb() { async addResultDb() {
return await this.appService.addResultsToDB() return await this.appService.addResultsToDB();
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment