Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KSZK
DevTeam
kszkepzes
Backend
Commits
afef4019
Commit
afef4019
authored
Aug 03, 2020
by
rlacko
💬
Browse files
Attendance docs
parent
97681a93
Pipeline
#4724
passed with stages
in 2 minutes and 1 second
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/resources/activity/activityDocs.yml
View file @
afef4019
...
...
@@ -107,7 +107,7 @@ components:
items
:
type
:
string
description
:
cuid of each attendance
comment
:
comment
s
:
type
:
array
items
:
type
:
string
...
...
src/resources/attendance/__tests__/attendanceFuncTest.js
View file @
afef4019
...
...
@@ -42,7 +42,9 @@ describe('/group "Mentor" Functionality', () => {
// GET One
test
(
`GET returns with allowed keys`
,
async
()
=>
{
const
newAttendance
=
await
Attendance
.
create
(
fakeAttendanceJson
)
let
response
=
await
authSession
.
get
(
`
${
endpointUrl
}
/
${
newAttendance
.
_id
}
`
)
let
response
=
await
authSession
.
get
(
`
${
endpointUrl
}
/id/
${
newAttendance
.
_id
}
`
)
expect
(
response
.
statusCode
).
toBe
(
200
)
validateKeys
(
response
.
body
.
data
,
defaultKeys
)
})
...
...
@@ -71,7 +73,7 @@ describe('/group "Mentor" Functionality', () => {
test
(
`Delete group returns with allowed keys`
,
async
()
=>
{
const
newAttendance
=
await
Attendance
.
create
(
fakeAttendanceJson
)
let
response
=
await
authSession
.
delete
(
`
${
endpointUrl
}
/
${
newAttendance
.
_id
}
`
`
${
endpointUrl
}
/
id/
${
newAttendance
.
_id
}
`
)
expect
(
response
.
statusCode
).
toBe
(
200
)
validateKeys
(
response
.
body
.
data
,
defaultKeys
)
...
...
@@ -80,7 +82,7 @@ describe('/group "Mentor" Functionality', () => {
test
(
`Update group returns with allowed keys`
,
async
()
=>
{
const
newAttendance
=
await
Attendance
.
create
(
fakeAttendanceJson
)
let
response
=
await
authSession
.
put
(
`
${
endpointUrl
}
/
${
newAttendance
.
_id
}
`
)
.
put
(
`
${
endpointUrl
}
/
id/
${
newAttendance
.
_id
}
`
)
.
send
({
state
:
'
present
'
,
})
...
...
src/resources/attendance/__tests__/attendancePermTest.js
View file @
afef4019
...
...
@@ -11,13 +11,28 @@ const fakeAttendanceJson = {
}
describe
(
'
/attendance Permission tests
'
,
()
=>
{
crudPermTest
(
app
,
endpointUrl
+
'
/id
'
,
Attendance
,
'
attendance
'
,
fakeAttendanceJson
,
[
false
,
false
,
true
,
true
,
true
],
[
// [role, create, readAll, readOne, update, delete]
[
'
none
'
,
false
,
false
,
false
,
false
,
false
],
[
'
normal
'
,
false
,
false
,
false
,
false
,
false
],
[
'
accepted
'
,
false
,
false
,
false
,
false
,
false
],
[
'
mentor
'
,
true
,
true
,
true
,
true
,
true
],
]
)
crudPermTest
(
app
,
endpointUrl
,
Attendance
,
'
attendance
'
,
fakeAttendanceJson
,
[
true
,
true
,
true
,
true
,
tru
e
],
[
true
,
true
,
false
,
false
,
fals
e
],
[
// [role, create, readAll, readOne, update, delete]
[
'
none
'
,
false
,
false
,
false
,
false
,
false
],
...
...
src/resources/attendance/attendanceDocs.yml
0 → 100644
View file @
afef4019
openapi
:
'
3.0.2'
info
:
title
:
'
Attendance
Endpoint'
version
:
'
1.0'
paths
:
/attendance
:
get
:
tags
:
-
'
Attendance'
summary
:
'
Get
a
List
of
attendances'
description
:
'
Have
to
be
mentor
for
this.'
operationId
:
'
getAllAttendance'
responses
:
'
200'
:
description
:
OK
content
:
application/json
:
schema
:
type
:
'
array'
items
:
$ref
:
'
#/components/schemas/Attendance'
post
:
tags
:
-
'
Attendance'
summary
:
'
Create
an
attendance'
description
:
'
Have
to
be
mentor
for
this.'
operationId
:
'
createAttendance'
requestBody
:
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
responses
:
'
200'
:
description
:
OK
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
/attendance/id/{id}
:
get
:
tags
:
-
'
Attendance'
summary
:
'
Get
an
attendance
by
ID'
description
:
'
Have
to
be
mentor
for
this.'
operationId
:
'
getAttendance'
responses
:
'
200'
:
description
:
OK
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
put
:
tags
:
-
'
Attendance'
summary
:
'
Update
an
attendance
by
ID'
description
:
'
Only
mentors
can
update
an
attendance.'
operationId
:
'
updateOneAttendance'
requestBody
:
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
responses
:
'
200'
:
description
:
OK
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
delete
:
tags
:
-
'
Attendance'
summary
:
'
Delete
an
attendance
by
ID'
description
:
'
Only
mentors
can
delete
an
attendance.'
operationId
:
'
deleteAttendance'
responses
:
'
200'
:
description
:
OK
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Attendance'
components
:
schemas
:
Attendance
:
type
:
object
properties
:
activity
:
type
:
string
description
:
cuid of each attendance
user
:
type
:
string
description
:
schacc of the user
state
:
type
:
string
enum
:
-
absent
-
present
-
cantcome
default
:
absent
comments
:
type
:
array
items
:
type
:
string
description
:
cuid of each comment
required
:
-
activity
-
user
-
state
src/resources/attendance/attendanceRouter.js
View file @
afef4019
...
...
@@ -4,15 +4,15 @@ const { isLoggedIn, isMentor } = require('../../middlewares/auth')
const
router
=
Router
()
// /api/
item
// /api/
v1/attendance/
router
.
route
(
'
/
'
)
.
get
(
isLoggedIn
,
isMentor
,
controllers
.
getMany
)
.
post
(
isLoggedIn
,
isMentor
,
controllers
.
createOne
)
// /api/
item
/:id
// /api/
v1/attendance/id
/:id
router
.
route
(
'
/:id
'
)
.
route
(
'
/
id/
:id
'
)
.
get
(
isLoggedIn
,
isMentor
,
controllers
.
getOne
)
.
put
(
isLoggedIn
,
isMentor
,
controllers
.
updateOne
)
.
delete
(
isLoggedIn
,
isMentor
,
controllers
.
removeOne
)
...
...
Write
Preview
Supports
Markdown
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