added berth in database and API

This commit is contained in:
Daniel Schick 2023-03-17 08:19:09 +01:00
parent b5c7a35e3d
commit 06b1fda4a0
2 changed files with 57 additions and 15 deletions

View File

@ -23,6 +23,8 @@ CREATE TABLE `ship` (
CREATE TABLE `shipcall` ( CREATE TABLE `shipcall` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ship_id` int(11) DEFAULT NULL, `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, `type` tinyint(4) DEFAULT NULL,
`eta` datetime DEFAULT NULL, `eta` datetime DEFAULT NULL,
`voyage` varchar(16) DEFAULT NULL, `voyage` varchar(16) DEFAULT NULL,
@ -66,3 +68,10 @@ CREATE TABLE `participant` (
`flags` int(10) unsigned DEFAULT NULL, `flags` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='An organization taking part'; ) 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';

View File

@ -19,7 +19,7 @@ servers:
paths: paths:
# tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html # tutorial: https://idratherbewriting.com/learnapidoc/pubapis_openapi_step4_paths_object.html
/verify: /verify:
get: get:
summary: Get the user id if successful summary: Get the user id if successful
responses: responses:
@ -37,13 +37,13 @@ paths:
500: 500:
$ref: '#/components/responses/500' $ref: '#/components/responses/500'
503: 503:
$ref: '#/components/responses/503' $ref: '#/components/responses/503'
/shipcalls: /shipcalls:
get: get:
summary: Gets a list of ship calls summary: Gets a list of ship calls
parameters: parameters:
- name: participant_id - name: participant_id
in: query in: query
required: true required: true
description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls" description: "**Id of participant**. *Example: 2*. Id of participant entity requesting ship calls"
@ -126,7 +126,7 @@ paths:
500: 500:
$ref: '#/components/responses/500' $ref: '#/components/responses/500'
503: 503:
$ref: '#/components/responses/503' $ref: '#/components/responses/503'
/times: /times:
get: get:
@ -143,7 +143,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/times_list' $ref: '#/components/schemas/times_list'
400: 400:
$ref: '#/components/responses/400' $ref: '#/components/responses/400'
401: 401:
@ -196,7 +196,7 @@ paths:
parameters: parameters:
- name: id - name: id
in: query in: query
required: true required: true
schema: schema:
$ref: '#/components/schemas/timesId' $ref: '#/components/schemas/timesId'
responses: responses:
@ -240,7 +240,24 @@ paths:
$ref: '#/components/responses/500' $ref: '#/components/responses/500'
503: 503:
$ref: '#/components/responses/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: components:
schemas: schemas:
timesId: timesId:
@ -254,21 +271,21 @@ components:
required: required:
- id - id
- ship_id - ship_id
- type - type
- eta - eta
- voyage - voyage
- etd - etd
properties: properties:
id: id:
$ref: '#/components/schemas/shipcallId' $ref: '#/components/schemas/shipcallId'
type: type:
type: string type: string
enum: enum:
- incoming - incoming
- outgoing - outgoing
- shifting - shifting
description: description:
type: string type: string
@ -280,7 +297,7 @@ components:
times: times:
type: object 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 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 - shipcall_id
- participant_id - participant_id
properties: properties:
@ -304,11 +321,27 @@ components:
type: integer type: integer
participant_id: participant_id:
type: integer type: integer
times_list: times_list:
type: array type: array
items: items:
$ref: '#/components/schemas/times' $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: notification:
type: object type: object
@ -328,7 +361,7 @@ components:
format: date-time format: date-time
acknowledged: acknowledged:
type: boolean type: boolean
notification_list: notification_list:
type: array type: array
items: items:
@ -346,7 +379,7 @@ components:
type: string type: string
postal code: postal code:
type: string type: string
city: city:
type: string type: string
Error: Error: