Skip to content

Commit

Permalink
validate.GET_re?
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Mar 6, 2024
1 parent 899769f commit 63bd0ab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
1 change: 0 additions & 1 deletion routes/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function GroupRoutes(server) {
tags: ['api'],
},
handler: async (request, h) => {

const groups = await Group.get({ id: parseInt(request.params.id, 10) })
/* c8 ignore next 10 */
if (groups.length !== 1) {
Expand Down
8 changes: 4 additions & 4 deletions routes/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ function PermissionRoutes(server) {
path: '/permission/{id}',
options: {
validate: {
query: validate.permission.v3,
query: validate.permission.GET_req,
},
response: {
schema: validate.permission.GET,
schema: validate.permission.GET_res,
},
tags: ['api'],
},
Expand Down Expand Up @@ -44,7 +44,7 @@ function PermissionRoutes(server) {
payload: validate.permission.POST,
},
response: {
schema: validate.permission.GET,
schema: validate.permission.GET_res,
},
tags: ['api'],
},
Expand Down Expand Up @@ -72,7 +72,7 @@ function PermissionRoutes(server) {
query: validate.permission.DELETE,
},
response: {
schema: validate.permission.GET,
schema: validate.permission.GET_res,
},
tags: ['api'],
},
Expand Down
2 changes: 1 addition & 1 deletion routes/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function SessionRoutes(server) {
path: '/session',
options: {
response: {
schema: validate.session.GET,
schema: validate.session.GET_res,
},
tags: ['api'],
},
Expand Down
19 changes: 14 additions & 5 deletions routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ function UserRoutes(server) {
method: 'GET',
path: '/user',
options: {
validate: {
query: validate.user.GET_req,
},
response: {
schema: validate.user.GET,
schema: validate.user.GET_res,
},
// tags: ['api'],
},
Expand All @@ -35,8 +38,11 @@ function UserRoutes(server) {
method: 'GET',
path: '/user/{id}',
options: {
validate: {
query: validate.user.GET_req,
},
response: {
schema: validate.user.GET,
schema: validate.user.GET_res,
},
tags: ['api'],
},
Expand Down Expand Up @@ -76,10 +82,10 @@ function UserRoutes(server) {
path: '/user',
options: {
validate: {
payload: validate.user.userPOST,
payload: validate.user.POST,
},
response: {
schema: validate.user.GET,
schema: validate.user.GET_res,
},
tags: ['api'],
},
Expand Down Expand Up @@ -109,8 +115,11 @@ function UserRoutes(server) {
method: 'DELETE',
path: '/user/{id}',
options: {
validate: {
query: validate.user.DELETE,
},
response: {
schema: validate.user.GET,
schema: validate.user.GET_res,
},
tags: ['api'],
},
Expand Down
2 changes: 1 addition & 1 deletion routes/user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('user routes', () => {
it(`GET /user/${userId2}?deleted=1`, async () => {
const res = await server.inject({
method: 'GET',
url: `/user/${userId2}?deleted=1`,
url: `/user/${userId2}?deleted=true`,
headers: {
Cookie: sessionCookie,
},
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function setup() {

async function teardown() {
await Nameserver.destroy({ id: nsCaseR.id })
await Nameserver.destroy({ id: nsCaseR.id -1 })
await Nameserver.destroy({ id: nsCaseR.id - 1 })
await Permission.destroy({ id: userCase.id })
await Permission.destroy({ id: userCase.id - 1 })
await Session.delete({ nt_user_id: userCase.id })
Expand Down

0 comments on commit 63bd0ab

Please sign in to comment.