feat: add relatives
This commit is contained in:
parent
9061da4f09
commit
e8ca067ae8
1 changed files with 10 additions and 0 deletions
|
|
@ -53,12 +53,22 @@ export default class CollesController {
|
|||
return response.notFound({ message: 'Colle not found' })
|
||||
}
|
||||
|
||||
const relatives = await Colle.query()
|
||||
.where('subjectId', colle.subjectId)
|
||||
.where('date', colle.date.toISO()!)
|
||||
.where('id', '!=', colle.id) // Exclude the current colle
|
||||
.whereHas('student', (query) => {
|
||||
query.where('className', auth.user!.className)
|
||||
})
|
||||
.preload('student')
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
...colle.serialize(),
|
||||
bjid: colle.bjid,
|
||||
bjsecret: colle.bjsecret,
|
||||
relatives,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue