Fixed the endpoints

This commit is contained in:
Jyotirmoy Bandyopadhayaya 2020-10-27 23:41:04 +05:30
parent 72efd04d38
commit 2092439b3f
32 changed files with 1121 additions and 1242 deletions

View File

@ -1,3 +1,3 @@
MASTER_KEY=dyB4cPIZpFV6X7VIYyKIWRC4GLUKQoV2
JWT_SECRET=sfDI9AxQb5zpNqVuDB4uB9jw1asIETH2
MASTER_KEY=n7qgqwuD7JVWL7cgVMuaqLn5LyWSw4Gf
JWT_SECRET=2TKqKamY6xlnogWXjHHy4phCxSidyyRx
MONGODB_URI_DEV=mongodb://docapi:VJFj04JeR1amOLK9@cluster0-shard-00-00.9qfp7.mongodb.net:27017,cluster0-shard-00-01.9qfp7.mongodb.net:27017,cluster0-shard-00-02.9qfp7.mongodb.net:27017/doc-api?ssl=true&replicaSet=atlas-zvo94h-shard-0&authSource=admin&retryWrites=true&w=majority

View File

@ -1,2 +1,2 @@
MASTER_KEY=dyB4cPIZpFV6X7VIYyKIWRC4GLUKQoV2
JWT_SECRET=sfDI9AxQb5zpNqVuDB4uB9jw1asIETH2
MASTER_KEY=n7qgqwuD7JVWL7cgVMuaqLn5LyWSw4Gf
JWT_SECRET=2TKqKamY6xlnogWXjHHy4phCxSidyyRx

2
backend/.gitignore vendored
View File

@ -5,6 +5,8 @@ public
.idea
.log
dist
docs
.env
npm-debug.log
.nyc_output
coverage

View File

@ -1,13 +1,13 @@
# docter-appointment v1.0.0
# doctor-apointment v0.0.0
- [Appointment](#appointment)
- [Create appointment](#create-appointment)
- [Delete appointment](#delete-appointment)
- [Retrieve appointment](#retrieve-appointment)
- [Retrieve appointments](#retrieve-appointments)
- [Update appointment](#update-appointment)
- [Apointment](#apointment)
- [Create apointment](#create-apointment)
- [Delete apointment](#delete-apointment)
- [Retrieve apointment](#retrieve-apointment)
- [Retrieve apointments](#retrieve-apointments)
- [Update apointment](#update-apointment)
- [Auth](#auth)
- [Authenticate](#authenticate)
@ -37,82 +37,78 @@
# Appointment
# Apointment
## Create appointment
## Create apointment
POST /appointments
POST /apointments
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| No | | <p>Appointment's No.</p> |
| PatientName | | <p>Appointment's PatientName.</p> |
| DocterName | | <p>Appointment's DocterName.</p> |
| Date | | <p>Appointment's Date.</p> |
| Time | | <p>Appointment's Time.</p> |
| Departent | | <p>Appointment's Departent.</p> |
| No | | <p>Apointment's No.</p> |
| PatientName | | <p>Apointment's PatientName.</p> |
| DocterName | | <p>Apointment's DocterName.</p> |
| Email | | <p>Apointment's Email.</p> |
| PhoneNo | | <p>Apointment's PhoneNo.</p> |
| Date | | <p>Apointment's Date.</p> |
| Time | | <p>Apointment's Time.</p> |
| Department | | <p>Apointment's Department.</p> |
## Delete appointment
## Delete apointment
DELETE /appointments/:id
DELETE /apointments/:id
## Retrieve apointment
GET /apointments/:id
## Retrieve apointments
GET /apointments
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
## Retrieve appointment
GET /appointments/:id
## Retrieve appointments
GET /appointments
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| q | String | **optional** <p>Query to search.</p> |
| page | Number | **optional** <p>Page number.</p> |
| limit | Number | **optional** <p>Amount of returned items.</p> |
| sort | String[] | **optional** <p>Order of returned items.</p> |
| fields | String[] | **optional** <p>Fields to be returned.</p> |
## Update appointment
## Update apointment
PUT /appointments/:id
PUT /apointments/:id
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| No | | <p>Appointment's No.</p> |
| PatientName | | <p>Appointment's PatientName.</p> |
| DocterName | | <p>Appointment's DocterName.</p> |
| Date | | <p>Appointment's Date.</p> |
| Time | | <p>Appointment's Time.</p> |
| Departent | | <p>Appointment's Departent.</p> |
| No | | <p>Apointment's No.</p> |
| PatientName | | <p>Apointment's PatientName.</p> |
| DocterName | | <p>Apointment's DocterName.</p> |
| Email | | <p>Apointment's Email.</p> |
| PhoneNo | | <p>Apointment's PhoneNo.</p> |
| Date | | <p>Apointment's Date.</p> |
| Time | | <p>Apointment's Time.</p> |
| Department | | <p>Apointment's Department.</p> |
# Auth
@ -140,7 +136,7 @@
POST /departments
POST /Departments
### Parameters
@ -148,48 +144,35 @@
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| Id | | <p>Department's Id.</p> |
| ID | | <p>Department's ID.</p> |
| Name | | <p>Department's Name.</p> |
| Nos | | <p>of Doctor Department's NoofDoctor.</p> |
| Nos | | <p>Department's Nos.</p> |
## Delete department
DELETE /departments/:id
DELETE /Departments/:id
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
## Retrieve department
GET /departments/:id
GET /Departments/:id
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
## Retrieve departments
GET /departments
GET /Departments
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| q | String | **optional** <p>Query to search.</p> |
| page | Number | **optional** <p>Page number.</p> |
| limit | Number | **optional** <p>Amount of returned items.</p> |
@ -200,17 +183,16 @@
PUT /departments/:id
PUT /Departments/:id
### Parameters
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| Id | | <p>Department's Id.</p> |
| ID | | <p>Department's ID.</p> |
| Name | | <p>Department's Name.</p> |
| Nos | | <p>of Doctor Department's NoofDoctor.</p> |
| Nos | | <p>Department's Nos.</p> |
# Doctor
@ -218,7 +200,7 @@
POST /doctors
POST /Doctors
### Parameters
@ -226,15 +208,15 @@
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| Id | | <p>Doctor's Id.</p> |
| ID | | <p>Doctor's ID.</p> |
| Name | | <p>Doctor's Name.</p> |
| Department | | <p>Doctor's Department.</p> |
| Dapartment | | <p>Doctor's Dapartment.</p> |
## Delete doctor
DELETE /doctors/:id
DELETE /Doctors/:id
### Parameters
@ -247,7 +229,7 @@
GET /doctors/:id
GET /Doctors/:id
### Parameters
@ -260,7 +242,7 @@
GET /doctors
GET /Doctors
### Parameters
@ -278,7 +260,7 @@
PUT /doctors/:id
PUT /Doctors/:id
### Parameters
@ -286,9 +268,9 @@
| Name | Type | Description |
|---------|-----------|--------------------------------------|
| access_token | String | <p>admin access token.</p> |
| Id | | <p>Doctor's Id.</p> |
| ID | | <p>Doctor's ID.</p> |
| Name | | <p>Doctor's Name.</p> |
| Department | | <p>Doctor's Department.</p> |
| Dapartment | | <p>Doctor's Dapartment.</p> |
# User

View File

@ -1,10 +1,10 @@
define({ "api": [
{
"type": "post",
"url": "/appointments",
"title": "Create appointment",
"name": "CreateAppointment",
"group": "Appointment",
"url": "/apointments",
"title": "Create apointment",
"name": "CreateApointment",
"group": "Apointment",
"parameter": {
"fields": {
"Parameter": [
@ -12,37 +12,49 @@ define({ "api": [
"group": "Parameter",
"optional": false,
"field": "No",
"description": "<p>Appointment's No.</p>"
"description": "<p>Apointment's No.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PatientName",
"description": "<p>Appointment's PatientName.</p>"
"description": "<p>Apointment's PatientName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "DocterName",
"description": "<p>Appointment's DocterName.</p>"
"description": "<p>Apointment's DocterName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Email",
"description": "<p>Apointment's Email.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PhoneNo",
"description": "<p>Apointment's PhoneNo.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Date",
"description": "<p>Appointment's Date.</p>"
"description": "<p>Apointment's Date.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Time",
"description": "<p>Appointment's Time.</p>"
"description": "<p>Apointment's Time.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Departent",
"description": "<p>Appointment's Departent.</p>"
"field": "Department",
"description": "<p>Apointment's Department.</p>"
}
]
}
@ -54,8 +66,8 @@ define({ "api": [
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -74,41 +86,21 @@ define({ "api": [
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "delete",
"url": "/appointments/:id",
"title": "Delete appointment",
"name": "DeleteAppointment",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"url": "/apointments/:id",
"title": "Delete apointment",
"name": "DeleteApointment",
"group": "Apointment",
"success": {
"fields": {
"Success 204": [
@ -128,27 +120,21 @@ define({ "api": [
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "get",
"url": "/appointments/:id",
"title": "Retrieve appointment",
"name": "RetrieveAppointment",
"group": "Appointment",
"url": "/apointments/:id",
"title": "Retrieve apointment",
"name": "RetrieveApointment",
"group": "Apointment",
"success": {
"fields": {
"Success 200": [
@ -156,8 +142,8 @@ define({ "api": [
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -176,38 +162,60 @@ define({ "api": [
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "get",
"url": "/appointments",
"title": "Retrieve appointments",
"name": "RetrieveAppointments",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
"url": "/apointments",
"title": "Retrieve apointments",
"name": "RetrieveApointments",
"group": "Apointment",
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of apointments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of apointments.</p>"
}
]
}
],
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"type": "String",
@ -250,108 +258,64 @@ define({ "api": [
}
]
}
},
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of appointments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of appointments.</p>"
}
]
}
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
}
},
{
"type": "put",
"url": "/appointments/:id",
"title": "Update appointment",
"name": "UpdateAppointment",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"url": "/apointments/:id",
"title": "Update apointment",
"name": "UpdateApointment",
"group": "Apointment",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "No",
"description": "<p>Appointment's No.</p>"
"description": "<p>Apointment's No.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PatientName",
"description": "<p>Appointment's PatientName.</p>"
"description": "<p>Apointment's PatientName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "DocterName",
"description": "<p>Appointment's DocterName.</p>"
"description": "<p>Apointment's DocterName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Email",
"description": "<p>Apointment's Email.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PhoneNo",
"description": "<p>Apointment's PhoneNo.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Date",
"description": "<p>Appointment's Date.</p>"
"description": "<p>Apointment's Date.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Time",
"description": "<p>Appointment's Time.</p>"
"description": "<p>Apointment's Time.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Departent",
"description": "<p>Appointment's Departent.</p>"
"field": "Department",
"description": "<p>Apointment's Department.</p>"
}
]
}
@ -363,8 +327,8 @@ define({ "api": [
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -383,20 +347,14 @@ define({ "api": [
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "post",
@ -475,7 +433,7 @@ define({ "api": [
},
{
"type": "post",
"url": "/departments",
"url": "/Departments",
"title": "Create department",
"name": "CreateDepartment",
"group": "Department",
@ -499,8 +457,8 @@ define({ "api": [
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Department's Id.</p>"
"field": "ID",
"description": "<p>Department's ID.</p>"
},
{
"group": "Parameter",
@ -512,7 +470,7 @@ define({ "api": [
"group": "Parameter",
"optional": false,
"field": "Nos",
"description": "<p>of Doctor Department's NoofDoctor.</p>"
"description": "<p>Department's Nos.</p>"
}
]
}
@ -556,35 +514,15 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "delete",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Delete department",
"name": "DeleteDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"success": {
"fields": {
"Success 204": [
@ -605,46 +543,20 @@ define({ "api": [
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "get",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Retrieve department",
"name": "RetrieveDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"success": {
"fields": {
"Success 200": [
@ -673,43 +585,59 @@ define({ "api": [
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "get",
"url": "/departments",
"url": "/Departments",
"title": "Retrieve departments",
"name": "RetrieveDepartments",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of departments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of departments.</p>"
}
]
}
],
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/Department/index.js",
"groupTitle": "Department",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"type": "String",
@ -752,78 +680,22 @@ define({ "api": [
}
]
}
},
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of departments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of departments.</p>"
}
]
}
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"groupTitle": "Department"
}
},
{
"type": "put",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Update department",
"name": "UpdateDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Department's Id.</p>"
"field": "ID",
"description": "<p>Department's ID.</p>"
},
{
"group": "Parameter",
@ -835,7 +707,7 @@ define({ "api": [
"group": "Parameter",
"optional": false,
"field": "Nos",
"description": "<p>of Doctor Department's NoofDoctor.</p>"
"description": "<p>Department's Nos.</p>"
}
]
}
@ -868,23 +740,17 @@ define({ "api": [
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "post",
"url": "/doctors",
"url": "/Doctors",
"title": "Create doctor",
"name": "CreateDoctor",
"group": "Doctor",
@ -908,8 +774,8 @@ define({ "api": [
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Doctor's Id.</p>"
"field": "ID",
"description": "<p>Doctor's ID.</p>"
},
{
"group": "Parameter",
@ -920,8 +786,8 @@ define({ "api": [
{
"group": "Parameter",
"optional": false,
"field": "Department",
"description": "<p>Doctor's Department.</p>"
"field": "Dapartment",
"description": "<p>Doctor's Dapartment.</p>"
}
]
}
@ -965,12 +831,12 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "delete",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Delete doctor",
"name": "DeleteDoctor",
"group": "Doctor",
@ -1025,12 +891,12 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "get",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Retrieve doctor",
"name": "RetrieveDoctor",
"group": "Doctor",
@ -1093,12 +959,12 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "get",
"url": "/doctors",
"url": "/Doctors",
"title": "Retrieve doctors",
"name": "RetrieveDoctors",
"group": "Doctor",
@ -1202,12 +1068,12 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "put",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Update doctor",
"name": "UpdateDoctor",
"group": "Doctor",
@ -1231,8 +1097,8 @@ define({ "api": [
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Doctor's Id.</p>"
"field": "ID",
"description": "<p>Doctor's ID.</p>"
},
{
"group": "Parameter",
@ -1243,8 +1109,8 @@ define({ "api": [
{
"group": "Parameter",
"optional": false,
"field": "Department",
"description": "<p>Doctor's Department.</p>"
"field": "Dapartment",
"description": "<p>Doctor's Dapartment.</p>"
}
]
}
@ -1288,7 +1154,7 @@ define({ "api": [
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{

View File

@ -1,10 +1,10 @@
[
{
"type": "post",
"url": "/appointments",
"title": "Create appointment",
"name": "CreateAppointment",
"group": "Appointment",
"url": "/apointments",
"title": "Create apointment",
"name": "CreateApointment",
"group": "Apointment",
"parameter": {
"fields": {
"Parameter": [
@ -12,37 +12,49 @@
"group": "Parameter",
"optional": false,
"field": "No",
"description": "<p>Appointment's No.</p>"
"description": "<p>Apointment's No.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PatientName",
"description": "<p>Appointment's PatientName.</p>"
"description": "<p>Apointment's PatientName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "DocterName",
"description": "<p>Appointment's DocterName.</p>"
"description": "<p>Apointment's DocterName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Email",
"description": "<p>Apointment's Email.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PhoneNo",
"description": "<p>Apointment's PhoneNo.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Date",
"description": "<p>Appointment's Date.</p>"
"description": "<p>Apointment's Date.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Time",
"description": "<p>Appointment's Time.</p>"
"description": "<p>Apointment's Time.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Departent",
"description": "<p>Appointment's Departent.</p>"
"field": "Department",
"description": "<p>Apointment's Department.</p>"
}
]
}
@ -54,8 +66,8 @@
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -74,41 +86,21 @@
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "delete",
"url": "/appointments/:id",
"title": "Delete appointment",
"name": "DeleteAppointment",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"url": "/apointments/:id",
"title": "Delete apointment",
"name": "DeleteApointment",
"group": "Apointment",
"success": {
"fields": {
"Success 204": [
@ -128,27 +120,21 @@
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "get",
"url": "/appointments/:id",
"title": "Retrieve appointment",
"name": "RetrieveAppointment",
"group": "Appointment",
"url": "/apointments/:id",
"title": "Retrieve apointment",
"name": "RetrieveApointment",
"group": "Apointment",
"success": {
"fields": {
"Success 200": [
@ -156,8 +142,8 @@
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -176,38 +162,60 @@
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "get",
"url": "/appointments",
"title": "Retrieve appointments",
"name": "RetrieveAppointments",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
"url": "/apointments",
"title": "Retrieve apointments",
"name": "RetrieveApointments",
"group": "Apointment",
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of apointments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of apointments.</p>"
}
]
}
],
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"type": "String",
@ -250,108 +258,64 @@
}
]
}
},
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of appointments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of appointments.</p>"
}
]
}
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
}
},
{
"type": "put",
"url": "/appointments/:id",
"title": "Update appointment",
"name": "UpdateAppointment",
"group": "Appointment",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"url": "/apointments/:id",
"title": "Update apointment",
"name": "UpdateApointment",
"group": "Apointment",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "No",
"description": "<p>Appointment's No.</p>"
"description": "<p>Apointment's No.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PatientName",
"description": "<p>Appointment's PatientName.</p>"
"description": "<p>Apointment's PatientName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "DocterName",
"description": "<p>Appointment's DocterName.</p>"
"description": "<p>Apointment's DocterName.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Email",
"description": "<p>Apointment's Email.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "PhoneNo",
"description": "<p>Apointment's PhoneNo.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Date",
"description": "<p>Appointment's Date.</p>"
"description": "<p>Apointment's Date.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Time",
"description": "<p>Appointment's Time.</p>"
"description": "<p>Apointment's Time.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Departent",
"description": "<p>Appointment's Departent.</p>"
"field": "Department",
"description": "<p>Apointment's Department.</p>"
}
]
}
@ -363,8 +327,8 @@
"group": "Success 200",
"type": "Object",
"optional": false,
"field": "appointment",
"description": "<p>Appointment's data.</p>"
"field": "apointment",
"description": "<p>Apointment's data.</p>"
}
]
}
@ -383,20 +347,14 @@
"group": "Error 4xx",
"optional": false,
"field": "404",
"description": "<p>Appointment not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
"description": "<p>Apointment not found.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/appointment/index.js",
"groupTitle": "Appointment"
"filename": "src/api/apointment/index.js",
"groupTitle": "Apointment"
},
{
"type": "post",
@ -475,7 +433,7 @@
},
{
"type": "post",
"url": "/departments",
"url": "/Departments",
"title": "Create department",
"name": "CreateDepartment",
"group": "Department",
@ -499,8 +457,8 @@
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Department's Id.</p>"
"field": "ID",
"description": "<p>Department's ID.</p>"
},
{
"group": "Parameter",
@ -512,7 +470,7 @@
"group": "Parameter",
"optional": false,
"field": "Nos",
"description": "<p>of Doctor Department's NoofDoctor.</p>"
"description": "<p>Department's Nos.</p>"
}
]
}
@ -556,35 +514,15 @@
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "delete",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Delete department",
"name": "DeleteDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"success": {
"fields": {
"Success 204": [
@ -605,46 +543,20 @@
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "get",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Retrieve department",
"name": "RetrieveDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
}
]
}
},
"success": {
"fields": {
"Success 200": [
@ -673,43 +585,59 @@
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "get",
"url": "/departments",
"url": "/Departments",
"title": "Retrieve departments",
"name": "RetrieveDepartments",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of departments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of departments.</p>"
}
]
}
],
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/Department/index.js",
"groupTitle": "Department",
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"type": "String",
@ -752,78 +680,22 @@
}
]
}
},
"success": {
"fields": {
"Success 200": [
{
"group": "Success 200",
"type": "Number",
"optional": false,
"field": "count",
"description": "<p>Total amount of departments.</p>"
},
{
"group": "Success 200",
"type": "Object[]",
"optional": false,
"field": "rows",
"description": "<p>List of departments.</p>"
}
]
}
},
"error": {
"fields": {
"Error 4xx": [
{
"group": "Error 4xx",
"type": "Object",
"optional": false,
"field": "400",
"description": "<p>Some parameters may contain invalid values.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"groupTitle": "Department"
}
},
{
"type": "put",
"url": "/departments/:id",
"url": "/Departments/:id",
"title": "Update department",
"name": "UpdateDepartment",
"group": "Department",
"permission": [
{
"name": "admin",
"title": "Admin access only",
"description": "<p>You must pass <code>access_token</code> parameter or a Bearer Token authorization header to access this endpoint.</p>"
}
],
"parameter": {
"fields": {
"Parameter": [
{
"group": "Parameter",
"type": "String",
"optional": false,
"field": "access_token",
"description": "<p>admin access token.</p>"
},
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Department's Id.</p>"
"field": "ID",
"description": "<p>Department's ID.</p>"
},
{
"group": "Parameter",
@ -835,7 +707,7 @@
"group": "Parameter",
"optional": false,
"field": "Nos",
"description": "<p>of Doctor Department's NoofDoctor.</p>"
"description": "<p>Department's Nos.</p>"
}
]
}
@ -868,23 +740,17 @@
"optional": false,
"field": "404",
"description": "<p>Department not found.</p>"
},
{
"group": "Error 4xx",
"optional": false,
"field": "401",
"description": "<p>admin access only.</p>"
}
]
}
},
"version": "0.0.0",
"filename": "src/api/department/index.js",
"filename": "src/api/Department/index.js",
"groupTitle": "Department"
},
{
"type": "post",
"url": "/doctors",
"url": "/Doctors",
"title": "Create doctor",
"name": "CreateDoctor",
"group": "Doctor",
@ -908,8 +774,8 @@
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Doctor's Id.</p>"
"field": "ID",
"description": "<p>Doctor's ID.</p>"
},
{
"group": "Parameter",
@ -920,8 +786,8 @@
{
"group": "Parameter",
"optional": false,
"field": "Department",
"description": "<p>Doctor's Department.</p>"
"field": "Dapartment",
"description": "<p>Doctor's Dapartment.</p>"
}
]
}
@ -965,12 +831,12 @@
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "delete",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Delete doctor",
"name": "DeleteDoctor",
"group": "Doctor",
@ -1025,12 +891,12 @@
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "get",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Retrieve doctor",
"name": "RetrieveDoctor",
"group": "Doctor",
@ -1093,12 +959,12 @@
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "get",
"url": "/doctors",
"url": "/Doctors",
"title": "Retrieve doctors",
"name": "RetrieveDoctors",
"group": "Doctor",
@ -1202,12 +1068,12 @@
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{
"type": "put",
"url": "/doctors/:id",
"url": "/Doctors/:id",
"title": "Update doctor",
"name": "UpdateDoctor",
"group": "Doctor",
@ -1231,8 +1097,8 @@
{
"group": "Parameter",
"optional": false,
"field": "Id",
"description": "<p>Doctor's Id.</p>"
"field": "ID",
"description": "<p>Doctor's ID.</p>"
},
{
"group": "Parameter",
@ -1243,8 +1109,8 @@
{
"group": "Parameter",
"optional": false,
"field": "Department",
"description": "<p>Doctor's Department.</p>"
"field": "Dapartment",
"description": "<p>Doctor's Dapartment.</p>"
}
]
}
@ -1288,7 +1154,7 @@
}
},
"version": "0.0.0",
"filename": "src/api/doctor/index.js",
"filename": "src/api/Doctor/index.js",
"groupTitle": "Doctor"
},
{

View File

@ -1,13 +1,13 @@
define({
"name": "docter-appointment",
"version": "1.0.0",
"name": "doctor-apointment",
"version": "0.0.0",
"description": "",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2020-10-22T19:01:49.797Z",
"time": "2020-10-27T18:03:57.724Z",
"url": "http://apidocjs.com",
"version": "0.20.1"
}

View File

@ -1,13 +1,13 @@
{
"name": "docter-appointment",
"version": "1.0.0",
"name": "doctor-apointment",
"version": "0.0.0",
"description": "",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2020-10-22T19:01:49.797Z",
"time": "2020-10-27T18:03:57.724Z",
"url": "http://apidocjs.com",
"version": "0.20.1"
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

@ -1,6 +1,6 @@
{
"name": "docter-appointment",
"version": "1.0.0",
"name": "doctor-apointment",
"version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1699,9 +1699,9 @@
"dev": true
},
"@types/node": {
"version": "14.14.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.2.tgz",
"integrity": "sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg==",
"version": "14.14.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.5.tgz",
"integrity": "sha512-H5Wn24s/ZOukBmDn03nnGTp18A60ny9AmCwnEcgJiTgSGsCO7k+NWP7zjCCbhlcnVCoI+co52dUAt9GMhOSULw==",
"dev": true
},
"@types/normalize-package-data": {
@ -1800,9 +1800,9 @@
"dev": true
},
"agent-base": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz",
"integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==",
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"dev": true,
"requires": {
"debug": "4"
@ -2610,13 +2610,13 @@
"integrity": "sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg=="
},
"buffer": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.1.tgz",
"integrity": "sha512-2z15UUHpS9/3tk9mY/q+Rl3rydOi7yMp5XWNQnRvoz+mJwiv8brqYwp9a+nOCtma6dwuEIxljD8W3ysVBZ05Vg==",
"dev": true,
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
"base64-js": "^1.3.1",
"ieee754": "^1.1.13"
}
},
"buffer-crc32": {
@ -2713,9 +2713,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30001150",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001150.tgz",
"integrity": "sha512-kiNKvihW0m36UhAFnl7bOAv0i1K1f6wpfVtTF5O5O82XzgtBnb05V0XeV3oZ968vfg2sRNChsHw8ASH2hDfoYQ=="
"version": "1.0.30001151",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001151.tgz",
"integrity": "sha512-Zh3sHqskX6mHNrqUerh+fkf0N72cMxrmflzje/JyVImfpknscMnkeJrlFGJcqTmaa0iszdYptGpWMJCRQDkBVw=="
},
"capture-exit": {
"version": "2.0.0",
@ -3500,9 +3500,9 @@
"dev": true
},
"electron-to-chromium": {
"version": "1.3.582",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.582.tgz",
"integrity": "sha512-0nCJ7cSqnkMC+kUuPs0YgklFHraWGl/xHqtZWWtOeVtyi+YqkoAOMGuZQad43DscXCQI/yizcTa3u6B5r+BLww=="
"version": "1.3.584",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.584.tgz",
"integrity": "sha512-NB3DzrTzJFhWkUp+nl2KtUtoFzrfGXTir2S+BU4tXGyXH9vlluPuFpE3pTKeH7+PY460tHLjKzh6K2+TWwW+Ww=="
},
"emoji-regex": {
"version": "7.0.3",
@ -7756,9 +7756,9 @@
}
},
"mongoose": {
"version": "5.10.9",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.10.9.tgz",
"integrity": "sha512-7dkr1d6Uyk87hELzoc6B7Zo7kkPTx8rKummk51Y0je2V2Ttsw0KFPwTp1G8JIbBta7Wpw8j15PJi0d33Ode2nw==",
"version": "5.10.11",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.10.11.tgz",
"integrity": "sha512-R5BFitKW94/S/Z48w+X+qi/eto66jWBcVEVA8nYVkBoBAPFGq7JSYP/0uso+ZHs+7XjSzTuui+SUllzxIrf9yA==",
"requires": {
"bson": "^1.1.4",
"kareem": "2.3.1",
@ -8699,13 +8699,13 @@
"dev": true
},
"prompts": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz",
"integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==",
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.0.tgz",
"integrity": "sha512-awZAKrk3vN6CroQukBL+R9051a4R3zCZBlJm/HBfrSZ8iTpYix3VX1vU4mveiLpiwmOJT4wokTF9m6HUk4KqWQ==",
"dev": true,
"requires": {
"kleur": "^3.0.3",
"sisteransi": "^1.0.4"
"sisteransi": "^1.0.5"
}
},
"propagate": {
@ -8750,9 +8750,9 @@
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"pupa": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.0.tgz",
"integrity": "sha512-Pj8EhJzFiPwnf4dEXpuUWwH8M/Yl4vpl4cN2RX1i3R77DWvbY5ZPKni7CCKkOYxz+XKt2fieemsV+WTZbIlYzg==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz",
"integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==",
"dev": true,
"requires": {
"escape-goat": "^2.0.0"
@ -10229,9 +10229,9 @@
}
},
"term-size": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz",
"integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz",
"integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==",
"dev": true
},
"terminal-link": {

View File

@ -1,6 +1,6 @@
{
"name": "docter-appointment",
"version": "1.0.0",
"name": "doctor-apointment",
"version": "0.0.0",
"main": "src",
"private": true,
"scripts": {

View File

@ -0,0 +1,41 @@
import { success, notFound } from '../../services/response/'
import { Apointment } from '.'
export const create = ({ bodymen: { body } }, res, next) =>
Apointment.create(body)
.then((apointment) => apointment.view(true))
.then(success(res, 201))
.catch(next)
export const index = ({ querymen: { query, select, cursor } }, res, next) =>
Apointment.count(query)
.then(count => Apointment.find(query, select, cursor)
.then((apointments) => ({
count,
rows: apointments.map((apointment) => apointment.view())
}))
)
.then(success(res))
.catch(next)
export const show = ({ params }, res, next) =>
Apointment.findById(params.id)
.then(notFound(res))
.then((apointment) => apointment ? apointment.view() : null)
.then(success(res))
.catch(next)
export const update = ({ bodymen: { body }, params }, res, next) =>
Apointment.findById(params.id)
.then(notFound(res))
.then((apointment) => apointment ? Object.assign(apointment, body).save() : null)
.then((apointment) => apointment ? apointment.view(true) : null)
.then(success(res))
.catch(next)
export const destroy = ({ params }, res, next) =>
Apointment.findById(params.id)
.then(notFound(res))
.then((apointment) => apointment ? apointment.remove() : null)
.then(success(res, 204))
.catch(next)

View File

@ -0,0 +1,85 @@
import { Router } from 'express'
import { middleware as query } from 'querymen'
import { middleware as body } from 'bodymen'
import { create, index, show, update, destroy } from './controller'
import { schema } from './model'
export Apointment, { schema } from './model'
const router = new Router()
const { No, PatientName, DocterName, Email, PhoneNo, Date, Time, Department } = schema.tree
/**
* @api {post} /apointments Create apointment
* @apiName CreateApointment
* @apiGroup Apointment
* @apiParam No Apointment's No.
* @apiParam PatientName Apointment's PatientName.
* @apiParam DocterName Apointment's DocterName.
* @apiParam Email Apointment's Email.
* @apiParam PhoneNo Apointment's PhoneNo.
* @apiParam Date Apointment's Date.
* @apiParam Time Apointment's Time.
* @apiParam Department Apointment's Department.
* @apiSuccess {Object} apointment Apointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Apointment not found.
*/
router.post('/',
body({ No, PatientName, DocterName, Email, PhoneNo, Date, Time, Department }),
create)
/**
* @api {get} /apointments Retrieve apointments
* @apiName RetrieveApointments
* @apiGroup Apointment
* @apiUse listParams
* @apiSuccess {Number} count Total amount of apointments.
* @apiSuccess {Object[]} rows List of apointments.
* @apiError {Object} 400 Some parameters may contain invalid values.
*/
router.get('/',
query(),
index)
/**
* @api {get} /apointments/:id Retrieve apointment
* @apiName RetrieveApointment
* @apiGroup Apointment
* @apiSuccess {Object} apointment Apointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Apointment not found.
*/
router.get('/:id',
show)
/**
* @api {put} /apointments/:id Update apointment
* @apiName UpdateApointment
* @apiGroup Apointment
* @apiParam No Apointment's No.
* @apiParam PatientName Apointment's PatientName.
* @apiParam DocterName Apointment's DocterName.
* @apiParam Email Apointment's Email.
* @apiParam PhoneNo Apointment's PhoneNo.
* @apiParam Date Apointment's Date.
* @apiParam Time Apointment's Time.
* @apiParam Department Apointment's Department.
* @apiSuccess {Object} apointment Apointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Apointment not found.
*/
router.put('/:id',
body({ No, PatientName, DocterName, Email, PhoneNo, Date, Time, Department }),
update)
/**
* @api {delete} /apointments/:id Delete apointment
* @apiName DeleteApointment
* @apiGroup Apointment
* @apiSuccess (Success 204) 204 No Content.
* @apiError 404 Apointment not found.
*/
router.delete('/:id',
destroy)
export default router

View File

@ -0,0 +1,86 @@
import request from 'supertest'
import { apiRoot } from '../../config'
import express from '../../services/express'
import routes, { Apointment } from '.'
const app = () => express(apiRoot, routes)
let apointment
beforeEach(async () => {
apointment = await Apointment.create({})
})
test('POST /apointments 201', async () => {
const { status, body } = await request(app())
.post(`${apiRoot}`)
.send({ No: 'test', PatientName: 'test', DocterName: 'test', Email: 'test', PhoneNo: 'test', Date: 'test', Time: 'test', Department: 'test' })
expect(status).toBe(201)
expect(typeof body).toEqual('object')
expect(body.No).toEqual('test')
expect(body.PatientName).toEqual('test')
expect(body.DocterName).toEqual('test')
expect(body.Email).toEqual('test')
expect(body.PhoneNo).toEqual('test')
expect(body.Date).toEqual('test')
expect(body.Time).toEqual('test')
expect(body.Department).toEqual('test')
})
test('GET /apointments 200', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}`)
expect(status).toBe(200)
expect(Array.isArray(body.rows)).toBe(true)
expect(Number.isNaN(body.count)).toBe(false)
})
test('GET /apointments/:id 200', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}/${apointment.id}`)
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(apointment.id)
})
test('GET /apointments/:id 404', async () => {
const { status } = await request(app())
.get(apiRoot + '/123456789098765432123456')
expect(status).toBe(404)
})
test('PUT /apointments/:id 200', async () => {
const { status, body } = await request(app())
.put(`${apiRoot}/${apointment.id}`)
.send({ No: 'test', PatientName: 'test', DocterName: 'test', Email: 'test', PhoneNo: 'test', Date: 'test', Time: 'test', Department: 'test' })
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(apointment.id)
expect(body.No).toEqual('test')
expect(body.PatientName).toEqual('test')
expect(body.DocterName).toEqual('test')
expect(body.Email).toEqual('test')
expect(body.PhoneNo).toEqual('test')
expect(body.Date).toEqual('test')
expect(body.Time).toEqual('test')
expect(body.Department).toEqual('test')
})
test('PUT /apointments/:id 404', async () => {
const { status } = await request(app())
.put(apiRoot + '/123456789098765432123456')
.send({ No: 'test', PatientName: 'test', DocterName: 'test', Email: 'test', PhoneNo: 'test', Date: 'test', Time: 'test', Department: 'test' })
expect(status).toBe(404)
})
test('DELETE /apointments/:id 204', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${apointment.id}`)
expect(status).toBe(204)
})
test('DELETE /apointments/:id 404', async () => {
const { status } = await request(app())
.delete(apiRoot + '/123456789098765432123456')
expect(status).toBe(404)
})

View File

@ -1,6 +1,6 @@
import mongoose, { Schema } from 'mongoose'
const appointmentSchema = new Schema({
const apointmentSchema = new Schema({
No: {
type: String
},
@ -10,13 +10,19 @@ const appointmentSchema = new Schema({
DocterName: {
type: String
},
Email: {
type: String
},
PhoneNo: {
type: String
},
Date: {
type: String
},
Time: {
type: String
},
Departent: {
Department: {
type: String
}
}, {
@ -27,7 +33,7 @@ const appointmentSchema = new Schema({
}
})
appointmentSchema.methods = {
apointmentSchema.methods = {
view (full) {
const view = {
// simple view
@ -35,9 +41,11 @@ appointmentSchema.methods = {
No: this.No,
PatientName: this.PatientName,
DocterName: this.DocterName,
Email: this.Email,
PhoneNo: this.PhoneNo,
Date: this.Date,
Time: this.Time,
Departent: this.Departent,
Department: this.Department,
createdAt: this.createdAt,
updatedAt: this.updatedAt
}
@ -49,7 +57,7 @@ appointmentSchema.methods = {
}
}
const model = mongoose.model('Appointment', appointmentSchema)
const model = mongoose.model('Apointment', apointmentSchema)
export const schema = model.schema
export default model

View File

@ -0,0 +1,41 @@
import { Apointment } from '.'
let apointment
beforeEach(async () => {
apointment = await Apointment.create({ No: 'test', PatientName: 'test', DocterName: 'test', Email: 'test', PhoneNo: 'test', Date: 'test', Time: 'test', Department: 'test' })
})
describe('view', () => {
it('returns simple view', () => {
const view = apointment.view()
expect(typeof view).toBe('object')
expect(view.id).toBe(apointment.id)
expect(view.No).toBe(apointment.No)
expect(view.PatientName).toBe(apointment.PatientName)
expect(view.DocterName).toBe(apointment.DocterName)
expect(view.Email).toBe(apointment.Email)
expect(view.PhoneNo).toBe(apointment.PhoneNo)
expect(view.Date).toBe(apointment.Date)
expect(view.Time).toBe(apointment.Time)
expect(view.Department).toBe(apointment.Department)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
it('returns full view', () => {
const view = apointment.view(true)
expect(typeof view).toBe('object')
expect(view.id).toBe(apointment.id)
expect(view.No).toBe(apointment.No)
expect(view.PatientName).toBe(apointment.PatientName)
expect(view.DocterName).toBe(apointment.DocterName)
expect(view.Email).toBe(apointment.Email)
expect(view.PhoneNo).toBe(apointment.PhoneNo)
expect(view.Date).toBe(apointment.Date)
expect(view.Time).toBe(apointment.Time)
expect(view.Department).toBe(apointment.Department)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
})

View File

@ -1,41 +0,0 @@
import { success, notFound } from '../../services/response/'
import { Appointment } from '.'
export const create = ({ bodymen: { body } }, res, next) =>
Appointment.create(body)
.then((appointment) => appointment.view(true))
.then(success(res, 201))
.catch(next)
export const index = ({ querymen: { query, select, cursor } }, res, next) =>
Appointment.count(query)
.then(count => Appointment.find(query, select, cursor)
.then((appointments) => ({
count,
rows: appointments.map((appointment) => appointment.view())
}))
)
.then(success(res))
.catch(next)
export const show = ({ params }, res, next) =>
Appointment.findById(params.id)
.then(notFound(res))
.then((appointment) => appointment ? appointment.view() : null)
.then(success(res))
.catch(next)
export const update = ({ bodymen: { body }, params }, res, next) =>
Appointment.findById(params.id)
.then(notFound(res))
.then((appointment) => appointment ? Object.assign(appointment, body).save() : null)
.then((appointment) => appointment ? appointment.view(true) : null)
.then(success(res))
.catch(next)
export const destroy = ({ params }, res, next) =>
Appointment.findById(params.id)
.then(notFound(res))
.then((appointment) => appointment ? appointment.remove() : null)
.then(success(res, 204))
.catch(next)

View File

@ -1,94 +0,0 @@
import { Router } from 'express'
import { middleware as query } from 'querymen'
import { middleware as body } from 'bodymen'
import { token } from '../../services/passport'
import { create, index, show, update, destroy } from './controller'
import { schema } from './model'
export Appointment, { schema } from './model'
const router = new Router()
const { No, PatientName, DocterName, Date, Time, Departent } = schema.tree
/**
* @api {post} /appointments Create appointment
* @apiName CreateAppointment
* @apiGroup Appointment
* @apiParam No Appointment's No.
* @apiParam PatientName Appointment's PatientName.
* @apiParam DocterName Appointment's DocterName.
* @apiParam Date Appointment's Date.
* @apiParam Time Appointment's Time.
* @apiParam Departent Appointment's Departent.
* @apiSuccess {Object} appointment Appointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Appointment not found.
*/
router.post('/',
body({ No, PatientName, DocterName, Date, Time, Departent }),
create)
/**
* @api {get} /appointments Retrieve appointments
* @apiName RetrieveAppointments
* @apiGroup Appointment
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiUse listParams
* @apiSuccess {Number} count Total amount of appointments.
* @apiSuccess {Object[]} rows List of appointments.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 401 admin access only.
*/
router.get('/',
token({ required: true, roles: ['admin'] }),
query(),
index)
/**
* @api {get} /appointments/:id Retrieve appointment
* @apiName RetrieveAppointment
* @apiGroup Appointment
* @apiSuccess {Object} appointment Appointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Appointment not found.
*/
router.get('/:id',
show)
/**
* @api {put} /appointments/:id Update appointment
* @apiName UpdateAppointment
* @apiGroup Appointment
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiParam No Appointment's No.
* @apiParam PatientName Appointment's PatientName.
* @apiParam DocterName Appointment's DocterName.
* @apiParam Date Appointment's Date.
* @apiParam Time Appointment's Time.
* @apiParam Departent Appointment's Departent.
* @apiSuccess {Object} appointment Appointment's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Appointment not found.
* @apiError 401 admin access only.
*/
router.put('/:id',
token({ required: true, roles: ['admin'] }),
body({ No, PatientName, DocterName, Date, Time, Departent }),
update)
/**
* @api {delete} /appointments/:id Delete appointment
* @apiName DeleteAppointment
* @apiGroup Appointment
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiSuccess (Success 204) 204 No Content.
* @apiError 404 Appointment not found.
* @apiError 401 admin access only.
*/
router.delete('/:id',
token({ required: true, roles: ['admin'] }),
destroy)
export default router

View File

@ -1,130 +0,0 @@
import request from 'supertest'
import { apiRoot } from '../../config'
import { signSync } from '../../services/jwt'
import express from '../../services/express'
import { User } from '../user'
import routes, { Appointment } from '.'
const app = () => express(apiRoot, routes)
let userSession, adminSession, appointment
beforeEach(async () => {
const user = await User.create({ email: 'a@a.com', password: '123456' })
const admin = await User.create({ email: 'c@c.com', password: '123456', role: 'admin' })
userSession = signSync(user.id)
adminSession = signSync(admin.id)
appointment = await Appointment.create({})
})
test('POST /appointments 201', async () => {
const { status, body } = await request(app())
.post(`${apiRoot}`)
.send({ No: 'test', PatientName: 'test', DocterName: 'test', Date: 'test', Time: 'test', Departent: 'test' })
expect(status).toBe(201)
expect(typeof body).toEqual('object')
expect(body.No).toEqual('test')
expect(body.PatientName).toEqual('test')
expect(body.DocterName).toEqual('test')
expect(body.Date).toEqual('test')
expect(body.Time).toEqual('test')
expect(body.Departent).toEqual('test')
})
test('GET /appointments 200 (admin)', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: adminSession })
expect(status).toBe(200)
expect(Array.isArray(body.rows)).toBe(true)
expect(Number.isNaN(body.count)).toBe(false)
})
test('GET /appointments 401 (user)', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('GET /appointments 401', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
expect(status).toBe(401)
})
test('GET /appointments/:id 200', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}/${appointment.id}`)
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(appointment.id)
})
test('GET /appointments/:id 404', async () => {
const { status } = await request(app())
.get(apiRoot + '/123456789098765432123456')
expect(status).toBe(404)
})
test('PUT /appointments/:id 200 (admin)', async () => {
const { status, body } = await request(app())
.put(`${apiRoot}/${appointment.id}`)
.send({ access_token: adminSession, No: 'test', PatientName: 'test', DocterName: 'test', Date: 'test', Time: 'test', Departent: 'test' })
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(appointment.id)
expect(body.No).toEqual('test')
expect(body.PatientName).toEqual('test')
expect(body.DocterName).toEqual('test')
expect(body.Date).toEqual('test')
expect(body.Time).toEqual('test')
expect(body.Departent).toEqual('test')
})
test('PUT /appointments/:id 401 (user)', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${appointment.id}`)
.send({ access_token: userSession })
expect(status).toBe(401)
})
test('PUT /appointments/:id 401', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${appointment.id}`)
expect(status).toBe(401)
})
test('PUT /appointments/:id 404 (admin)', async () => {
const { status } = await request(app())
.put(apiRoot + '/123456789098765432123456')
.send({ access_token: adminSession, No: 'test', PatientName: 'test', DocterName: 'test', Date: 'test', Time: 'test', Departent: 'test' })
expect(status).toBe(404)
})
test('DELETE /appointments/:id 204 (admin)', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${appointment.id}`)
.query({ access_token: adminSession })
expect(status).toBe(204)
})
test('DELETE /appointments/:id 401 (user)', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${appointment.id}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('DELETE /appointments/:id 401', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${appointment.id}`)
expect(status).toBe(401)
})
test('DELETE /appointments/:id 404 (admin)', async () => {
const { status } = await request(app())
.delete(apiRoot + '/123456789098765432123456')
.query({ access_token: adminSession })
expect(status).toBe(404)
})

View File

@ -1,37 +0,0 @@
import { Appointment } from '.'
let appointment
beforeEach(async () => {
appointment = await Appointment.create({ No: 'test', PatientName: 'test', DocterName: 'test', Date: 'test', Time: 'test', Departent: 'test' })
})
describe('view', () => {
it('returns simple view', () => {
const view = appointment.view()
expect(typeof view).toBe('object')
expect(view.id).toBe(appointment.id)
expect(view.No).toBe(appointment.No)
expect(view.PatientName).toBe(appointment.PatientName)
expect(view.DocterName).toBe(appointment.DocterName)
expect(view.Date).toBe(appointment.Date)
expect(view.Time).toBe(appointment.Time)
expect(view.Departent).toBe(appointment.Departent)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
it('returns full view', () => {
const view = appointment.view(true)
expect(typeof view).toBe('object')
expect(view.id).toBe(appointment.id)
expect(view.No).toBe(appointment.No)
expect(view.PatientName).toBe(appointment.PatientName)
expect(view.DocterName).toBe(appointment.DocterName)
expect(view.Date).toBe(appointment.Date)
expect(view.Time).toBe(appointment.Time)
expect(view.Departent).toBe(appointment.Departent)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
})

View File

@ -7,17 +7,17 @@ import { schema } from './model'
export Department, { schema } from './model'
const router = new Router()
const { Id, Name, NoofDoctor } = schema.tree
const { ID, Name, Nos } = schema.tree
/**
* @api {post} /departments Create department
* @api {post} /Departments Create department
* @apiName CreateDepartment
* @apiGroup Department
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiParam Id Department's Id.
* @apiParam ID Department's ID.
* @apiParam Name Department's Name.
* @apiParam NoofDoctor Department's NoofDoctor.
* @apiParam Nos Department's Nos.
* @apiSuccess {Object} department Department's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Department not found.
@ -25,72 +25,56 @@ const { Id, Name, NoofDoctor } = schema.tree
*/
router.post('/',
token({ required: true, roles: ['admin'] }),
body({ Id, Name, NoofDoctor }),
body({ ID, Name, Nos }),
create)
/**
* @api {get} /departments Retrieve departments
* @api {get} /Departments Retrieve departments
* @apiName RetrieveDepartments
* @apiGroup Department
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiUse listParams
* @apiSuccess {Number} count Total amount of departments.
* @apiSuccess {Object[]} rows List of departments.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 401 admin access only.
*/
router.get('/',
token({ required: true, roles: ['admin'] }),
query(),
index)
/**
* @api {get} /departments/:id Retrieve department
* @api {get} /Departments/:id Retrieve department
* @apiName RetrieveDepartment
* @apiGroup Department
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiSuccess {Object} department Department's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Department not found.
* @apiError 401 admin access only.
*/
router.get('/:id',
token({ required: true, roles: ['admin'] }),
show)
/**
* @api {put} /departments/:id Update department
* @api {put} /Departments/:id Update department
* @apiName UpdateDepartment
* @apiGroup Department
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiParam Id Department's Id.
* @apiParam ID Department's ID.
* @apiParam Name Department's Name.
* @apiParam NoofDoctor Department's NoofDoctor.
* @apiParam Nos Department's Nos.
* @apiSuccess {Object} department Department's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Department not found.
* @apiError 401 admin access only.
*/
router.put('/:id',
token({ required: true, roles: ['admin'] }),
body({ Id, Name, NoofDoctor }),
body({ ID, Name, Nos }),
update)
/**
* @api {delete} /departments/:id Delete department
* @api {delete} /Departments/:id Delete department
* @apiName DeleteDepartment
* @apiGroup Department
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiSuccess (Success 204) 204 No Content.
* @apiError 404 Department not found.
* @apiError 401 admin access only.
*/
router.delete('/:id',
token({ required: true, roles: ['admin'] }),
destroy)
export default router

View File

@ -17,136 +17,79 @@ beforeEach(async () => {
department = await Department.create({})
})
test('POST /departments 201 (admin)', async () => {
test('POST /Departments 201 (admin)', async () => {
const { status, body } = await request(app())
.post(`${apiRoot}`)
.send({ access_token: adminSession, Id: 'test', Name: 'test', NoofDoctor: 'test' })
.send({ access_token: adminSession, ID: 'test', Name: 'test', Nos: 'test' })
expect(status).toBe(201)
expect(typeof body).toEqual('object')
expect(body.Id).toEqual('test')
expect(body.ID).toEqual('test')
expect(body.Name).toEqual('test')
expect(body.NoofDoctor).toEqual('test')
expect(body.Nos).toEqual('test')
})
test('POST /departments 401 (user)', async () => {
test('POST /Departments 401 (user)', async () => {
const { status } = await request(app())
.post(`${apiRoot}`)
.send({ access_token: userSession })
expect(status).toBe(401)
})
test('POST /departments 401', async () => {
test('POST /Departments 401', async () => {
const { status } = await request(app())
.post(`${apiRoot}`)
expect(status).toBe(401)
})
test('GET /departments 200 (admin)', async () => {
test('GET /Departments 200', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: adminSession })
expect(status).toBe(200)
expect(Array.isArray(body.rows)).toBe(true)
expect(Number.isNaN(body.count)).toBe(false)
})
test('GET /departments 401 (user)', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('GET /departments 401', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
expect(status).toBe(401)
})
test('GET /departments/:id 200 (admin)', async () => {
test('GET /Departments/:id 200', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}/${department.id}`)
.query({ access_token: adminSession })
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(department.id)
})
test('GET /departments/:id 401 (user)', async () => {
const { status } = await request(app())
.get(`${apiRoot}/${department.id}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('GET /departments/:id 401', async () => {
const { status } = await request(app())
.get(`${apiRoot}/${department.id}`)
expect(status).toBe(401)
})
test('GET /departments/:id 404 (admin)', async () => {
test('GET /Departments/:id 404', async () => {
const { status } = await request(app())
.get(apiRoot + '/123456789098765432123456')
.query({ access_token: adminSession })
expect(status).toBe(404)
})
test('PUT /departments/:id 200 (admin)', async () => {
test('PUT /Departments/:id 200', async () => {
const { status, body } = await request(app())
.put(`${apiRoot}/${department.id}`)
.send({ access_token: adminSession, Id: 'test', Name: 'test', NoofDoctor: 'test' })
.send({ ID: 'test', Name: 'test', Nos: 'test' })
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(department.id)
expect(body.Id).toEqual('test')
expect(body.ID).toEqual('test')
expect(body.Name).toEqual('test')
expect(body.NoofDoctor).toEqual('test')
expect(body.Nos).toEqual('test')
})
test('PUT /departments/:id 401 (user)', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${department.id}`)
.send({ access_token: userSession })
expect(status).toBe(401)
})
test('PUT /departments/:id 401', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${department.id}`)
expect(status).toBe(401)
})
test('PUT /departments/:id 404 (admin)', async () => {
test('PUT /Departments/:id 404', async () => {
const { status } = await request(app())
.put(apiRoot + '/123456789098765432123456')
.send({ access_token: adminSession, Id: 'test', Name: 'test', NoofDoctor: 'test' })
.send({ ID: 'test', Name: 'test', Nos: 'test' })
expect(status).toBe(404)
})
test('DELETE /departments/:id 204 (admin)', async () => {
test('DELETE /Departments/:id 204', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${department.id}`)
.query({ access_token: adminSession })
expect(status).toBe(204)
})
test('DELETE /departments/:id 401 (user)', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${department.id}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('DELETE /departments/:id 401', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${department.id}`)
expect(status).toBe(401)
})
test('DELETE /departments/:id 404 (admin)', async () => {
test('DELETE /Departments/:id 404', async () => {
const { status } = await request(app())
.delete(apiRoot + '/123456789098765432123456')
.query({ access_token: adminSession })
expect(status).toBe(404)
})

View File

@ -1,13 +1,13 @@
import mongoose, { Schema } from 'mongoose'
const departmentSchema = new Schema({
Id: {
ID: {
type: String
},
Name: {
type: String
},
NoofDoctor: {
Nos: {
type: String
}
}, {
@ -23,9 +23,9 @@ departmentSchema.methods = {
const view = {
// simple view
id: this.id,
Id: this.Id,
ID: this.ID,
Name: this.Name,
NoofDoctor: this.NoofDoctor,
Nos: this.Nos,
createdAt: this.createdAt,
updatedAt: this.updatedAt
}

View File

@ -3,7 +3,7 @@ import { Department } from '.'
let department
beforeEach(async () => {
department = await Department.create({ Id: 'test', Name: 'test', NoofDoctor: 'test' })
department = await Department.create({ ID: 'test', Name: 'test', Nos: 'test' })
})
describe('view', () => {
@ -11,9 +11,9 @@ describe('view', () => {
const view = department.view()
expect(typeof view).toBe('object')
expect(view.id).toBe(department.id)
expect(view.Id).toBe(department.Id)
expect(view.ID).toBe(department.ID)
expect(view.Name).toBe(department.Name)
expect(view.NoofDoctor).toBe(department.NoofDoctor)
expect(view.Nos).toBe(department.Nos)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
@ -22,9 +22,9 @@ describe('view', () => {
const view = department.view(true)
expect(typeof view).toBe('object')
expect(view.id).toBe(department.id)
expect(view.Id).toBe(department.Id)
expect(view.ID).toBe(department.ID)
expect(view.Name).toBe(department.Name)
expect(view.NoofDoctor).toBe(department.NoofDoctor)
expect(view.Nos).toBe(department.Nos)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})

View File

@ -7,17 +7,17 @@ import { schema } from './model'
export Doctor, { schema } from './model'
const router = new Router()
const { Id, Name, Department } = schema.tree
const { ID, Name, Dapartment } = schema.tree
/**
* @api {post} /doctors Create doctor
* @api {post} /Doctors Create doctor
* @apiName CreateDoctor
* @apiGroup Doctor
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiParam Id Doctor's Id.
* @apiParam ID Doctor's ID.
* @apiParam Name Doctor's Name.
* @apiParam Department Doctor's Department.
* @apiParam Dapartment Doctor's Dapartment.
* @apiSuccess {Object} doctor Doctor's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Doctor not found.
@ -25,11 +25,11 @@ const { Id, Name, Department } = schema.tree
*/
router.post('/',
token({ required: true, roles: ['admin'] }),
body({ Id, Name, Department }),
body({ ID, Name, Dapartment }),
create)
/**
* @api {get} /doctors Retrieve doctors
* @api {get} /Doctors Retrieve doctors
* @apiName RetrieveDoctors
* @apiGroup Doctor
* @apiPermission admin
@ -46,7 +46,7 @@ router.get('/',
index)
/**
* @api {get} /doctors/:id Retrieve doctor
* @api {get} /Doctors/:id Retrieve doctor
* @apiName RetrieveDoctor
* @apiGroup Doctor
* @apiPermission admin
@ -61,14 +61,14 @@ router.get('/:id',
show)
/**
* @api {put} /doctors/:id Update doctor
* @api {put} /Doctors/:id Update doctor
* @apiName UpdateDoctor
* @apiGroup Doctor
* @apiPermission admin
* @apiParam {String} access_token admin access token.
* @apiParam Id Doctor's Id.
* @apiParam ID Doctor's ID.
* @apiParam Name Doctor's Name.
* @apiParam Department Doctor's Department.
* @apiParam Dapartment Doctor's Dapartment.
* @apiSuccess {Object} doctor Doctor's data.
* @apiError {Object} 400 Some parameters may contain invalid values.
* @apiError 404 Doctor not found.
@ -76,11 +76,11 @@ router.get('/:id',
*/
router.put('/:id',
token({ required: true, roles: ['admin'] }),
body({ Id, Name, Department }),
body({ ID, Name, Dapartment }),
update)
/**
* @api {delete} /doctors/:id Delete doctor
* @api {delete} /Doctors/:id Delete doctor
* @apiName DeleteDoctor
* @apiGroup Doctor
* @apiPermission admin

View File

@ -17,31 +17,31 @@ beforeEach(async () => {
doctor = await Doctor.create({})
})
test('POST /doctors 201 (admin)', async () => {
test('POST /Doctors 201 (admin)', async () => {
const { status, body } = await request(app())
.post(`${apiRoot}`)
.send({ access_token: adminSession, Id: 'test', Name: 'test', Department: 'test' })
.send({ access_token: adminSession, ID: 'test', Name: 'test', Dapartment: 'test' })
expect(status).toBe(201)
expect(typeof body).toEqual('object')
expect(body.Id).toEqual('test')
expect(body.ID).toEqual('test')
expect(body.Name).toEqual('test')
expect(body.Department).toEqual('test')
expect(body.Dapartment).toEqual('test')
})
test('POST /doctors 401 (user)', async () => {
test('POST /Doctors 401 (user)', async () => {
const { status } = await request(app())
.post(`${apiRoot}`)
.send({ access_token: userSession })
expect(status).toBe(401)
})
test('POST /doctors 401', async () => {
test('POST /Doctors 401', async () => {
const { status } = await request(app())
.post(`${apiRoot}`)
expect(status).toBe(401)
})
test('GET /doctors 200 (admin)', async () => {
test('GET /Doctors 200 (admin)', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: adminSession })
@ -50,20 +50,20 @@ test('GET /doctors 200 (admin)', async () => {
expect(Number.isNaN(body.count)).toBe(false)
})
test('GET /doctors 401 (user)', async () => {
test('GET /Doctors 401 (user)', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('GET /doctors 401', async () => {
test('GET /Doctors 401', async () => {
const { status } = await request(app())
.get(`${apiRoot}`)
expect(status).toBe(401)
})
test('GET /doctors/:id 200 (admin)', async () => {
test('GET /Doctors/:id 200 (admin)', async () => {
const { status, body } = await request(app())
.get(`${apiRoot}/${doctor.id}`)
.query({ access_token: adminSession })
@ -72,79 +72,79 @@ test('GET /doctors/:id 200 (admin)', async () => {
expect(body.id).toEqual(doctor.id)
})
test('GET /doctors/:id 401 (user)', async () => {
test('GET /Doctors/:id 401 (user)', async () => {
const { status } = await request(app())
.get(`${apiRoot}/${doctor.id}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('GET /doctors/:id 401', async () => {
test('GET /Doctors/:id 401', async () => {
const { status } = await request(app())
.get(`${apiRoot}/${doctor.id}`)
expect(status).toBe(401)
})
test('GET /doctors/:id 404 (admin)', async () => {
test('GET /Doctors/:id 404 (admin)', async () => {
const { status } = await request(app())
.get(apiRoot + '/123456789098765432123456')
.query({ access_token: adminSession })
expect(status).toBe(404)
})
test('PUT /doctors/:id 200 (admin)', async () => {
test('PUT /Doctors/:id 200 (admin)', async () => {
const { status, body } = await request(app())
.put(`${apiRoot}/${doctor.id}`)
.send({ access_token: adminSession, Id: 'test', Name: 'test', Department: 'test' })
.send({ access_token: adminSession, ID: 'test', Name: 'test', Dapartment: 'test' })
expect(status).toBe(200)
expect(typeof body).toEqual('object')
expect(body.id).toEqual(doctor.id)
expect(body.Id).toEqual('test')
expect(body.ID).toEqual('test')
expect(body.Name).toEqual('test')
expect(body.Department).toEqual('test')
expect(body.Dapartment).toEqual('test')
})
test('PUT /doctors/:id 401 (user)', async () => {
test('PUT /Doctors/:id 401 (user)', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${doctor.id}`)
.send({ access_token: userSession })
expect(status).toBe(401)
})
test('PUT /doctors/:id 401', async () => {
test('PUT /Doctors/:id 401', async () => {
const { status } = await request(app())
.put(`${apiRoot}/${doctor.id}`)
expect(status).toBe(401)
})
test('PUT /doctors/:id 404 (admin)', async () => {
test('PUT /Doctors/:id 404 (admin)', async () => {
const { status } = await request(app())
.put(apiRoot + '/123456789098765432123456')
.send({ access_token: adminSession, Id: 'test', Name: 'test', Department: 'test' })
.send({ access_token: adminSession, ID: 'test', Name: 'test', Dapartment: 'test' })
expect(status).toBe(404)
})
test('DELETE /doctors/:id 204 (admin)', async () => {
test('DELETE /Doctors/:id 204 (admin)', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${doctor.id}`)
.query({ access_token: adminSession })
expect(status).toBe(204)
})
test('DELETE /doctors/:id 401 (user)', async () => {
test('DELETE /Doctors/:id 401 (user)', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${doctor.id}`)
.query({ access_token: userSession })
expect(status).toBe(401)
})
test('DELETE /doctors/:id 401', async () => {
test('DELETE /Doctors/:id 401', async () => {
const { status } = await request(app())
.delete(`${apiRoot}/${doctor.id}`)
expect(status).toBe(401)
})
test('DELETE /doctors/:id 404 (admin)', async () => {
test('DELETE /Doctors/:id 404 (admin)', async () => {
const { status } = await request(app())
.delete(apiRoot + '/123456789098765432123456')
.query({ access_token: adminSession })

View File

@ -1,13 +1,13 @@
import mongoose, { Schema } from 'mongoose'
const doctorSchema = new Schema({
Id: {
ID: {
type: String
},
Name: {
type: String
},
Department: {
Dapartment: {
type: String
}
}, {
@ -23,9 +23,9 @@ doctorSchema.methods = {
const view = {
// simple view
id: this.id,
Id: this.Id,
ID: this.ID,
Name: this.Name,
Department: this.Department,
Dapartment: this.Dapartment,
createdAt: this.createdAt,
updatedAt: this.updatedAt
}

View File

@ -3,7 +3,7 @@ import { Doctor } from '.'
let doctor
beforeEach(async () => {
doctor = await Doctor.create({ Id: 'test', Name: 'test', Department: 'test' })
doctor = await Doctor.create({ ID: 'test', Name: 'test', Dapartment: 'test' })
})
describe('view', () => {
@ -11,9 +11,9 @@ describe('view', () => {
const view = doctor.view()
expect(typeof view).toBe('object')
expect(view.id).toBe(doctor.id)
expect(view.Id).toBe(doctor.Id)
expect(view.ID).toBe(doctor.ID)
expect(view.Name).toBe(doctor.Name)
expect(view.Department).toBe(doctor.Department)
expect(view.Dapartment).toBe(doctor.Dapartment)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})
@ -22,9 +22,9 @@ describe('view', () => {
const view = doctor.view(true)
expect(typeof view).toBe('object')
expect(view.id).toBe(doctor.id)
expect(view.Id).toBe(doctor.Id)
expect(view.ID).toBe(doctor.ID)
expect(view.Name).toBe(doctor.Name)
expect(view.Department).toBe(doctor.Department)
expect(view.Dapartment).toBe(doctor.Dapartment)
expect(view.createdAt).toBeTruthy()
expect(view.updatedAt).toBeTruthy()
})

View File

@ -1,9 +1,9 @@
import { Router } from 'express'
import user from './user'
import auth from './auth'
import appointment from './appointment'
import department from './department'
import doctor from './doctor'
import apointment from './apointment'
import department from './Department'
import doctor from './Doctor'
const router = new Router()
@ -32,8 +32,8 @@ const router = new Router()
*/
router.use('/users', user)
router.use('/auth', auth)
router.use('/appointments', appointment)
router.use('/departments', department)
router.use('/doctors', doctor)
router.use('/apointments', apointment)
router.use('/Departments', department)
router.use('/Doctors', doctor)
export default router

View File

@ -1,6 +1,5 @@
import { success, notFound } from '../../services/response/'
import { User } from '.'
import { sign } from '../../services/jwt'
export const index = ({ querymen: { query, select, cursor } }, res, next) =>
User.count(query)
@ -25,11 +24,8 @@ export const showMe = ({ user }, res) =>
export const create = ({ bodymen: { body } }, res, next) =>
User.create(body)
.then(user => {
sign(user.id)
.then((token) => ({ token, user: user.view(true) }))
.then(success(res, 201))
})
.then((user) => user.view(true))
.then(success(res, 201))
.catch((err) => {
/* istanbul ignore else */
if (err.name === 'MongoError' && err.code === 11000) {

View File

@ -104,9 +104,7 @@ test('POST /users 201 (master)', async () => {
.send({ access_token: masterKey, email: 'd@d.com', password: '123456' })
expect(status).toBe(201)
expect(typeof body).toBe('object')
expect(typeof body.user).toBe('object')
expect(typeof body.token).toBe('string')
expect(body.user.email).toBe('d@d.com')
expect(body.email).toBe('d@d.com')
})
test('POST /users 201 (master)', async () => {
@ -115,9 +113,7 @@ test('POST /users 201 (master)', async () => {
.send({ access_token: masterKey, email: 'd@d.com', password: '123456', role: 'user' })
expect(status).toBe(201)
expect(typeof body).toBe('object')
expect(typeof body.user).toBe('object')
expect(typeof body.token).toBe('string')
expect(body.user.email).toBe('d@d.com')
expect(body.email).toBe('d@d.com')
})
test('POST /users 201 (master)', async () => {
@ -126,9 +122,7 @@ test('POST /users 201 (master)', async () => {
.send({ access_token: masterKey, email: 'd@d.com', password: '123456', role: 'admin' })
expect(status).toBe(201)
expect(typeof body).toBe('object')
expect(typeof body.user).toBe('object')
expect(typeof body.token).toBe('string')
expect(body.user.email).toBe('d@d.com')
expect(body.email).toBe('d@d.com')
})
test('POST /users 409 (master) - duplicated email', async () => {

View File

@ -39,7 +39,7 @@ const config = {
test: { },
development: {
mongo: {
uri: process.env.MONGODB_URI_DEV || 'mongodb://localhost/docter-appointment-dev',
uri: 'mongodb://localhost/doctor-apointment-dev',
options: {
debug: true
}
@ -49,7 +49,7 @@ const config = {
ip: process.env.IP || undefined,
port: process.env.PORT || 8080,
mongo: {
uri: process.env.MONGODB_URI_DEV || 'mongodb://localhost/docter-appointment'
uri: process.env.MONGODB_URI || 'mongodb://localhost/doctor-apointment'
}
}
}