Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최은석
/
ossw-project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최은석
2022-06-04 10:06:44 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
69feb6bf7a8e794b42368ff69d9193faf1ed92ce
69feb6bf
1 parent
6f35fa12
fix waiting with showing chat within 1 hour
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
server/Router/api.js
server/Router/api.js
View file @
69feb6b
...
...
@@ -185,8 +185,22 @@ router.get('/api/waiting', async (req, res) => {
const
today
=
getCurrentDate
();
var
waitingList
=
await
waitingModel
.
findOne
({
date
:
today
});
if
(
waitingList
==
null
)
waitingList
=
[]
else
waitingList
=
waitingList
.
waiting
;
res
.
send
(
waitingList
);
else
waitingList
=
waitingList
.
waiting
;
const
date
=
new
Date
();
var
hour
=
date
.
getHours
();
hour
=
hour
<
10
?
'0'
+
hour
.
toString
()
:
hour
.
toString
();
var
minute
=
date
.
getMinutes
();
minute
=
minute
<
10
?
'0'
+
minute
.
toString
()
:
minute
.
toString
();
const
time
=
Number
(
hour
+
minute
);
var
result
=
[];
for
(
const
waiting
of
waitingList
){
if
(
time
-
Number
(
waiting
.
time
.
replace
(
':'
,
''
))
<=
100
){
result
.
push
(
waiting
)
}
}
res
.
send
(
result
);
}
catch
(
err
)
{
res
.
send
(
err
.
message
);
...
...
@@ -199,7 +213,11 @@ router.post('/api/waiting', async (req, res) => {
var
waitingList
=
await
waitingModel
.
findOne
({
date
:
today
});
const
date
=
new
Date
();
const
time
=
date
.
getHours
()
+
":"
+
date
.
getMinutes
();
var
hour
=
date
.
getHours
();
hour
=
hour
<
10
?
'0'
+
hour
.
toString
()
:
hour
.
toString
();
var
minute
=
date
.
getMinutes
();
minute
=
minute
<
10
?
'0'
+
minute
.
toString
()
:
minute
.
toString
();
const
time
=
hour
+
":"
+
minute
;
const
newWaiting
=
{
value
:
req
.
body
.
value
,
time
:
time
};
if
(
waitingList
==
null
)
await
waitingModel
({
date
:
today
,
waiting
:
[
newWaiting
]}).
save
();
...
...
Please
register
or
login
to post a comment