Commit e65ebee7 authored by velayat's avatar velayat
Browse files

add show result rest api

parent fbb24753
This diff is collapsed.
......@@ -4,20 +4,18 @@ import { GetUserScore } from './dto/get-user-score';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) { }
@Get('get-comments')
async getCommentsFromIG() {
return await this.appService.getComments();
}
constructor(private readonly appService: AppService) {}
// @Get('get-comments')
// async getCommentsFromIG() {
// return await this.appService.getComments();
// }
@Get('get-followers')
async getFollowers() {
return await this.appService.getFollowers();
}
@Post()
async getUserScore(@Body() getUserScoreDto: GetUserScore) {
return await this.appService.calculateUserScore(getUserScoreDto.username);
......@@ -25,7 +23,7 @@ export class AppController {
@Get('calculate-result')
async calculateResult() {
return await this.appService.getResults()
return await this.appService.getResults();
}
@Get('get-results')
......@@ -40,12 +38,16 @@ export class AppController {
@Get('shuffle')
async shuffle() {
return await this.appService.getShuffleData()
return await this.appService.getShuffleData();
}
@Get('add-lottory-result')
async addResultDb() {
return await this.appService.addResultsToDB()
return await this.appService.addResultsToDB();
}
@Get('get-lottory-result')
async getResultDb() {
return await this.appService.getResultDb();
}
}
......@@ -36,7 +36,8 @@ export class AppService implements OnApplicationBootstrap {
) {}
async onApplicationBootstrap() {
this.client = await this.login('sohe.ibs', 'kaka1374');
this.client = await this.login('shahriarvelayat', 'shve8864@@');
// this.client = null
}
private async login(username, password) {
......@@ -665,6 +666,10 @@ export class AppService implements OnApplicationBootstrap {
await this.lotoryResultModel.insertMany(comptitionArray);
return 'successfull';
}
async getResultDb() {
return await this.lotoryResultModel.find().select({username:1,index:1});
}
}
export class ResultResponse {
......
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