Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
b723b364
Commit
b723b364
authored
Nov 10, 2021
by
Choi Ga Young
Browse files
order 수정
parent
3d73bac1
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/controllers/subject.controller.js
View file @
b723b364
...
...
@@ -11,7 +11,7 @@ const findAll = async (req, res) => {
if
(
subjectId
)
findList
=
await
Subject
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
id
:
subjectId
},
{
userId
:
userId
}]
},
order
:
[[
'
updatedAt
'
,
'
DESC
'
]]
})
else
findList
=
await
Subject
.
findAll
({
where
:
{
userId
:
userId
},
order
:
[[
'
updatedAt
'
,
'
DESC
'
]]
})
const
subjectAndPlan
=
await
Promise
.
all
(
findList
.
map
(
async
(
subjectInfo
)
=>
{
const
resPlan
=
await
Plan
.
findAll
({
where
:
{
subjectId
:
subjectInfo
.
id
}
})
const
resPlan
=
await
Plan
.
findAll
({
where
:
{
subjectId
:
subjectInfo
.
id
}
,
order
:[[
sequelize
.
literal
(
'
checked, deadline
'
),
'
ASC
'
]]
})
subjectInfo
.
dataValues
.
planList
=
resPlan
return
subjectInfo
}))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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