Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebBack
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
websystem
WebBack
Merge requests
!7
[
#6
] Schedule 컨트롤러, 라우터, 로직 개발
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[
#6
] Schedule 컨트롤러, 라우터, 로직 개발
feature/#6
into
develop
Overview
0
Commits
12
Pipelines
0
Changes
1
Merged
조대희
requested to merge
feature/#6
into
develop
6 months ago
Overview
0
Commits
12
Pipelines
0
Changes
1
Expand
컨트롤러 생성
라우터 생성
유틸 함수 생성
Schedule 모델 컬럼 추가
Schedule 서비스 버그 수정
0
0
Merge request reports
Viewing commit
360e88be
Prev
Next
Show latest version
1 file
+
39
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
360e88be
feat: 스케줄 생성 컨트롤러 (
#6
)
· 360e88be
조대희
authored
6 months ago
controllers/scheduleController.js
+
39
−
0
Options
const
ScheduleService
=
require
(
'
../services/scheduleService
'
);
class
scheduleController
{
/**
* 스케줄 생성
* POST /api/schedules
* 해당 사용자 id는 auth 미들웨어에서 설정된 사용자 정보 이용
* req.user = User 모델의 인스턴스
*/
async
createSchedule
(
req
,
res
)
{
try
{
const
userId
=
req
.
user
.
id
;
const
{
title
,
start_time
,
end_time
,
is_fixed
}
=
req
.
body
;
const
schedule
=
await
ScheduleService
.
createSchedule
({
userId
,
title
,
start_time
,
end_time
,
is_fixed
});
return
res
.
status
(
201
).
json
({
success
:
true
,
data
:
{
schedule
}
});
}
catch
(
error
)
{
return
res
.
status
(
400
).
json
({
success
:
false
,
error
:
{
message
:
error
.
message
,
code
:
'
SCHEDULE_CREATE_ERROR
'
}
});
}
}
}
\ No newline at end of file
Loading