Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
shahriar
instagram-service
Commits
c017535c
Commit
c017535c
authored
Aug 07, 2021
by
soheib
Browse files
update score
parent
6c3c1cd9
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
src/app.controller.ts
View file @
c017535c
...
...
@@ -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
src/app.module.ts
View file @
c017535c
import
{
Module
,
OnApplicationBootstrap
}
from
'
@nestjs/common
'
;
import
{
MongooseModule
}
from
'
@nestjs/mongoose
'
;
import
{
Account
Follower
s
Schema
}
from
'
./
account.
follower
s
'
;
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
%4040
8009
@185.231.180.248:27017/
instagram-lottry
?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-256
'
,
'
mongodb://
azadi:azadi
%4040
10
@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
:
LottoryResult
Schema
},
{
name
:
'
Follower
'
,
schema
:
Follower
Schema
},
]),
MongooseModule
.
forFeature
([
{
name
:
'
AccountFollower
'
,
schema
:
AccountFollowersSchema
},
{
name
:
'
Like
'
,
schema
:
LikeSchema
},
]),
MongooseModule
.
forFeature
([
{
name
:
'
Comment
'
,
schema
:
CommentSchema
},
]),
],
controllers
:
[
AppController
],
...
...
src/app.service.ts
View file @
c017535c
This diff is collapsed.
Click to expand it.
src/main.ts
View file @
c017535c
...
...
@@ -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
();
src/comment.schema.ts
→
src/
models/
comment.schema.ts
View file @
c017535c
File moved
src/
account.
follower
s
.ts
→
src/
models/
follower
.schema
.ts
View file @
c017535c
import
{
Prop
,
Schema
,
SchemaFactory
}
from
'
@nestjs/mongoose
'
;
import
{
Document
,
Types
}
from
'
mongoose
'
;
export
type
Account
Follower
s
Document
=
Account
Follower
s
&
Document
;
export
type
FollowerDocument
=
Follower
&
Document
;
@
Schema
({
timestamps
:
true
})
export
class
Account
Follower
s
{
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
Account
Follower
s
Schema
=
SchemaFactory
.
createForClass
(
Account
Follower
s
);
export
const
FollowerSchema
=
SchemaFactory
.
createForClass
(
Follower
);
src/models/like.schema.ts
0 → 100644
View file @
c017535c
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
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment