Commit c017535c authored by soheib's avatar soheib
Browse files

update score

parent 6c3c1cd9
......@@ -6,43 +6,48 @@ import { GetUserScore } from './dto/get-user-score';
export class AppController {
constructor(private readonly appService: AppService) {}
@Get('get-followers')
async getFollowers() {
return await this.appService.getFollowers();
}
@Post()
async getUserScore(@Body() getUserScoreDto: GetUserScore) {
return await this.appService.calculateUserScore(getUserScoreDto.username);
}
@Get('calculate-result')
async calculateResult() {
return await this.appService.getResults();
}
@Get('get-results')
async getResults() {
return await this.appService.getFinalResults();
}
@Post('search')
@Post('get-score')
async getUserResults(@Body('username') username: string) {
return await this.appService.getUserResult(username);
}
@Get('shuffle')
async shuffle() {
return await this.appService.getShuffleData();
}
@Get('add-lottory-result')
async addResultDb() {
return await this.appService.addResultsToDB();
}
@Get('get-lottory-result')
async getResultDb() {
return await this.appService.getResultDb();
return await this.appService.getUserLikes(username);
}
}
// @Get('get-followers')
// async getFollowers() {
// return await this.appService.getFollowers();
// }
// @Post()
// async getUserScore(@Body() getUserScoreDto: GetUserScore) {
// return await this.appService.calculateUserScore(getUserScoreDto.username);
// }
// @Get('calculate-result')
// async calculateResult() {
// return await this.appService.getResults();
// }
// @Get('get-results')
// async getResults() {
// return await this.appService.getFinalResults();
// }
// @Post('search')
// async getUserResults(@Body('username') username: string) {
// return await this.appService.getUserResult(username);
// }
// @Get('shuffle')
// async shuffle() {
// return await this.appService.getShuffleData();
// }
// @Get('add-lottory-result')
// async addResultDb() {
// return await this.appService.addResultsToDB();
// }
// @Get('get-lottory-result')
// async getResultDb() {
// return await this.appService.getResultDb();
// }
\ No newline at end of file
import { Module, OnApplicationBootstrap } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { AccountFollowersSchema } from './account.followers';
import { FollowerSchema } from './models/follower.schema';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { CommentSchema } from './comment.schema';
import { LottoryResultSchema } from './LottoryResult.schema';
import { RequestSchema } from './request.schema';
import { ResultSchema } from './result.schema';
import { LikeSchema } from './models/like.schema';
import { CommentSchema } from './models/comment.schema';
@Module({
imports: [
MongooseModule.forRoot(
'mongodb://netware:Netware%40408009@185.231.180.248:27017/instagram-lottry?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-256',
'mongodb://azadi:azadi%404010@185.231.180.248:27017/?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-256',
),
MongooseModule.forFeature([{ name: 'Request', schema: RequestSchema }]),
MongooseModule.forFeature([{ name: 'Comment', schema: CommentSchema }]),
MongooseModule.forFeature([{ name: 'Result', schema: ResultSchema }]),
MongooseModule.forFeature([
{ name: 'LottoryResult', schema: LottoryResultSchema },
{ name: 'Follower', schema: FollowerSchema },
]),
MongooseModule.forFeature([
{ name: 'AccountFollower', schema: AccountFollowersSchema },
{ name: 'Like', schema: LikeSchema },
]),
MongooseModule.forFeature([
{ name: 'Comment', schema: CommentSchema },
]),
],
controllers: [AppController],
......
This diff is collapsed.
......@@ -9,6 +9,9 @@ async function bootstrap() {
credentials: true,
})
await app.listen(4001);
await app.listen(4001).then(()=>{
console.log(`server start on port 4001`);
})
}
bootstrap();
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
export type AccountFollowersDocument = AccountFollowers & Document;
export type FollowerDocument = Follower & Document;
@Schema({ timestamps: true })
export class AccountFollowers {
export class Follower {
@Prop()
_id: Types.ObjectId;
@Prop()
username: string;
@Prop()
user_id: string;
@Prop()
full_name: string;
@Prop()
bussines_username: string;
profile_pic: string;
@Prop({ type: Object })
follower_obejct: Object;
@Prop()
account: string;
@Prop()
follow_date: number;
}
export const AccountFollowersSchema =
SchemaFactory.createForClass(AccountFollowers);
export const FollowerSchema =
SchemaFactory.createForClass(Follower);
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
export type LikeDocument = Like & Document;
@Schema({ timestamps: true })
export class Like {
@Prop()
_id: Types.ObjectId;
@Prop()
username: string;
@Prop()
post_short_code: string;
}
export const LikeSchema =
SchemaFactory.createForClass(Like);
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