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
e54f4eb1
Commit
e54f4eb1
authored
Jul 27, 2021
by
soheib
Browse files
enable cors
parent
df70e6f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app.service.ts
View file @
e54f4eb1
...
...
@@ -531,10 +531,11 @@ export class AppService implements OnApplicationBootstrap {
async
getUserResult
(
username
:
string
)
{
let
userRes
=
await
this
.
resultModel
.
findOne
({
username
})
let
userIndexs
=
await
this
.
lotoryResultModel
.
find
({
username
})
let
response
:
ResultResponse
=
new
ResultResponse
()
response
.
users
=
new
Array
<
any
>
()
response
.
lottory_chances_codes
=
new
Array
<
string
>
()
userRes
.
pending_users
.
forEach
(
user
=>
{
response
.
users
.
push
({
userId
:
user
,
status
:
CommentStatus
.
notFollower
})
})
...
...
@@ -550,10 +551,11 @@ export class AppService implements OnApplicationBootstrap {
response
.
invalid_mentions
=
userRes
.
invalid_mentions
,
response
.
pending_mentions
=
userRes
.
pending_mentions
,
response
.
score
=
userRes
.
score
userIndexs
.
forEach
(
index
=>
{
response
.
lottory_chances_codes
.
push
(
index
.
index
.
toString
())
})
return
{
response
response
}
}
...
...
@@ -622,6 +624,7 @@ export class ResultResponse {
pending_mentions
:
number
score
:
number
users
?:
Array
<
any
>
lottory_chances_codes
:
Array
<
string
>
}
...
...
src/main.ts
View file @
e54f4eb1
...
...
@@ -4,5 +4,11 @@ import { AppModule } from './app.module';
async
function
bootstrap
()
{
const
app
=
await
NestFactory
.
create
(
AppModule
);
await
app
.
listen
(
3000
);
app
.
enableCors
({
origin
:
'
*
'
,
methods
:
'
GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS
'
,
credentials
:
true
,
})
}
bootstrap
();
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