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
Commits
ecbb6dbe
Commit
ecbb6dbe
authored
4 months ago
by
조대희
Browse files
Options
Downloads
Patches
Plain Diff
fix: 스케줄 수정 & 만료일 구하기 수정 (
#6
)
parent
be3b1ba9
No related branches found
Branches containing commit
No related tags found
2 merge requests
!31
Develop
,
!7
[#6] Schedule 컨트롤러, 라우터, 로직 개발
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/scheduleService.js
+19
-9
19 additions, 9 deletions
services/scheduleService.js
with
19 additions
and
9 deletions
services/scheduleService.js
+
19
−
9
View file @
ecbb6dbe
...
@@ -54,13 +54,16 @@ class scheduleService {
...
@@ -54,13 +54,16 @@ class scheduleService {
/**
/**
* 유동 스케줄 만료일 구하기
* 유동 스케줄 만료일 구하기
*/
*/
getNextMonday
()
{
getNextMonday
(
startTime
)
{
const
date
=
new
Date
();
const
date
=
new
Date
(
startTime
);
const
day
=
date
.
getDay
();
const
day
=
date
.
getDay
();
const
daysUntilNextMonday
=
(
8
-
day
)
%
7
;
const
daysUntilNextMonday
=
(
7
-
day
+
1
)
%
7
;
date
.
setDate
(
date
.
getDate
()
+
daysUntilNextMonday
);
date
.
setHours
(
0
,
0
,
0
,
0
);
const
nextMonday
=
new
Date
(
date
);
return
date
;
nextMonday
.
setDate
(
date
.
getDate
()
+
daysUntilNextMonday
);
nextMonday
.
setHours
(
0
,
0
,
0
,
0
);
// 자정으로 설정
return
nextMonday
;
}
}
/**
/**
...
@@ -81,7 +84,7 @@ class scheduleService {
...
@@ -81,7 +84,7 @@ class scheduleService {
start_time
,
start_time
,
end_time
,
end_time
,
is_fixed
,
is_fixed
,
expiry_date
:
is_fixed
?
null
:
this
.
getNextMonday
()
expiry_date
:
is_fixed
?
null
:
this
.
getNextMonday
(
start_time
)
};
};
return
Schedule
.
create
(
scheduleData
,
{
transaction
});
return
Schedule
.
create
(
scheduleData
,
{
transaction
});
...
@@ -114,8 +117,15 @@ class scheduleService {
...
@@ -114,8 +117,15 @@ class scheduleService {
throw
new
Error
(
'
Schedule overlaps with existing schedule
'
);
throw
new
Error
(
'
Schedule overlaps with existing schedule
'
);
}
}
delete
updateData
.
is_fixed
;
const
is_fixed
=
schedule
.
is_fixed
;
return
schedule
.
update
(
updateData
,
{
transaction
});
const
updatedData
=
{
...
updateData
,
expiry_date
:
is_fixed
?
null
:
this
.
getNextMonday
(
updateData
.
start_time
),
updatedAt
:
new
Date
()
};
delete
updatedData
.
is_fixed
;
return
schedule
.
update
(
updatedData
,
{
transaction
});
});
});
}
}
...
...
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