diff --git a/misc/create_schema.sql b/misc/create_schema.sql index 1338ffc..2fffd06 100644 --- a/misc/create_schema.sql +++ b/misc/create_schema.sql @@ -23,6 +23,8 @@ CREATE TABLE `ship` ( CREATE TABLE `shipcall` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `ship_id` int(11) DEFAULT NULL, + `arrival_berth_id` int(11) DEFAULT NULL, + `departure_berth_id` int(11) DEFAULT NULL, `type` tinyint(4) DEFAULT NULL, `eta` datetime DEFAULT NULL, `voyage` varchar(16) DEFAULT NULL, @@ -66,3 +68,10 @@ CREATE TABLE `participant` ( `flags` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='An organization taking part'; + +CREATE TABLE `berth` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name1` varchar(128) DEFAULT NULL, + `name2` varchar(128) DEFAULT NULL, + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Place of ship for a ship call'; diff --git a/misc/index.yaml b/misc/index.yaml index 67a6825..7445e1a 100644 --- a/misc/index.yaml +++ b/misc/index.yaml @@ -19,7 +19,7 @@ servers: paths: # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html - /verify: + /verify: get: summary: Get the user id if successful responses: @@ -37,13 +37,13 @@ paths: 500: $ref: '#/components/responses/500' 503: - $ref: '#/components/responses/503' + $ref: '#/components/responses/503' /shipcalls: get: summary: Gets a list of ship calls parameters: - - name: participant_id + - name: participant_id in: query required: true description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" @@ -126,7 +126,7 @@ paths: 500: $ref: '#/components/responses/500' 503: - $ref: '#/components/responses/503' + $ref: '#/components/responses/503' /times: get: @@ -143,7 +143,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/times_list' + $ref: '#/components/schemas/times_list' 400: $ref: '#/components/responses/400' 401: @@ -196,7 +196,7 @@ paths: parameters: - name: id in: query - required: true + required: true schema: $ref: '#/components/schemas/timesId' responses: @@ -240,7 +240,24 @@ paths: $ref: '#/components/responses/500' 503: $ref: '#/components/responses/503' - + /berths: + get: + summary: Gets a list of all berths registered + responses: + 200: + description: list of berths + content: + application/json: + schema: + $ref: '#/components/schemas/berth_list' + 400: + $ref: '#/components/responses/400' + 401: + $ref: '#/components/responses/401' + 500: + $ref: '#/components/responses/500' + 503: + $ref: '#/components/responses/503' components: schemas: timesId: @@ -254,21 +271,21 @@ components: required: - id - ship_id - - type + - type - eta - voyage - etd properties: id: $ref: '#/components/schemas/shipcallId' - + type: type: string enum: - incoming - outgoing - - shifting - + - shifting + description: type: string @@ -280,7 +297,7 @@ components: times: type: object description: the id parameter needs to be missing on POST and to be present on PUT (Update) calls, otherwise a 400 response will be generated - required: + required: - shipcall_id - participant_id properties: @@ -304,11 +321,27 @@ components: type: integer participant_id: type: integer - + times_list: type: array items: $ref: '#/components/schemas/times' + + berth: + type: object + description: Ship berth used for a ship call + properties: + id: + type: integer + name1: + type: string + name2: + type: string + + berth_list: + type: array + items: + $ref: '#/components/schemas/berth' notification: type: object @@ -328,7 +361,7 @@ components: format: date-time acknowledged: type: boolean - + notification_list: type: array items: @@ -346,7 +379,7 @@ components: type: string postal code: type: string - city: + city: type: string Error: