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
e65ebee7
Commit
e65ebee7
authored
Jul 28, 2021
by
velayat
Browse files
add show result rest api
parent
fbb24753
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
package-lock.json
View file @
e65ebee7
This diff is collapsed.
Click to expand it.
src/app.controller.ts
View file @
e65ebee7
...
...
@@ -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
();
}
}
src/app.service.ts
View file @
e65ebee7
...
...
@@ -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
{
...
...
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