Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
When Meet - Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
websystem2023-2
When Meet - Backend
Commits
32d94dab
Commit
32d94dab
authored
1 year ago
by
Wo-ogie
Browse files
Options
Downloads
Patches
Plain Diff
feat: 서버 구동 시 아직 종료되지 않은 약속들을 scheduler에 등록하여 종료될 수 있도록 설정하는 로직 추가
parent
73c06f81
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app.js
+3
-0
3 additions, 0 deletions
app.js
schedules/checkMeetings.js
+31
-0
31 additions, 0 deletions
schedules/checkMeetings.js
with
34 additions
and
0 deletions
app.js
+
3
−
0
View file @
32d94dab
...
@@ -13,7 +13,10 @@ const participantRouter = require('./routes/participant');
...
@@ -13,7 +13,10 @@ const participantRouter = require('./routes/participant');
const
myScheduleRouter
=
require
(
'
./routes/mySchedule
'
);
const
myScheduleRouter
=
require
(
'
./routes/mySchedule
'
);
const
{
sequelize
}
=
require
(
'
./models
'
);
const
{
sequelize
}
=
require
(
'
./models
'
);
const
checkMeetings
=
require
(
'
./schedules/checkMeetings
'
);
const
app
=
express
();
const
app
=
express
();
checkMeetings
();
app
.
set
(
'
port
'
,
process
.
env
.
PORT
||
3000
);
app
.
set
(
'
port
'
,
process
.
env
.
PORT
||
3000
);
sequelize
sequelize
...
...
This diff is collapsed.
Click to expand it.
schedules/checkMeetings.js
0 → 100644
+
31
−
0
View file @
32d94dab
const
{
scheduleJob
}
=
require
(
'
node-schedule
'
);
const
{
Op
}
=
require
(
'
sequelize
'
);
const
{
Meeting
}
=
require
(
'
../models
'
);
const
{
closeMeetingById
}
=
require
(
'
../services/meeting
'
);
module
.
exports
=
async
()
=>
{
console
.
log
(
'
Check meeting... 종료되지 않은 미팅을 찾아 스케줄러에 등록합니다.
'
,
);
try
{
const
meetings
=
await
Meeting
.
findAll
({
where
:
{
voteExpiresAt
:
{
[
Op
.
ne
]:
null
,
},
isClosed
:
false
,
},
});
console
.
log
(
'
meetings
'
,
meetings
);
meetings
.
forEach
((
meeting
)
=>
{
scheduleJob
(
meeting
.
voteExpiresAt
,
async
()
=>
{
await
closeMeetingById
(
meeting
.
id
);
});
});
}
catch
(
error
)
{
console
.
log
(
'
Scheduler에 등록할 meeting을 확인하던 중 에러가 발생했습니다.
'
,
error
,
);
}
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment