Search
https://gitlab.fel.cvut.cz/B181_B6B36OMO/seminar/tree/master/cv11.1_solution
https://gitlab.fel.cvut.cz/B181_B6B36OMO/seminar/tree/master/cv11.2_solution
https://gitlab.fel.cvut.cz/B181_B6B36OMO/seminar/tree/master/cv11.3_solution
https://gitlab.fel.cvut.cz/B181_B6B36OMO/seminar/tree/master/cv11.4_solution
Přednáška:
OpenAPISwagger:
https://swagger.io/getting-started/
https://idratherbewriting.com/learnapidoc/pubapis_swagger_intro.html
Připravte specifikace rozhraní komponent knihovního systému, který umožňuje čtenáři online rezervaci vypůjčení knihy ve vybrané čítárně.
Systém umožní vyhledat knihu v inventáři knih, vyhledat a vybrat čítárnu, kde si čtenář knihu vypůjčí a provést rezervaci. Rezervovanou knihu pak knihovna distribuuje z centrálního archivu do konkrétní čítárny, kde ji čtenář dostane k dispozici.
Řešení systému bude v architektonickém stylu microservice. Komunikačním protokolem mezi microservice bude REST API.
Systém bude složený z následujících microservice:
Online Reservation – umožňuje najít knihu v registru centrálního systému, rezervovat knihu, udržuje informace o stavu rezervace
Central Archive – spracuje centrální registr knih, eviduje distribuci knihy do čítárny
Reading Room - eviduje knihy, které přišly z centrálního skladu, spravuje vypůjčení knihy čtenářem
Book: description: "Kniha, kterou si může čtenář vypůjčit." required: - title - author - isbn properties: bookId: type: integer title: type: string author: type: string numberOfPages: type: integer format: int32 isbn: type: string pattern: "^(?:ISBN(?:-10)?:?)?(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$)[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]$"
Reader: description: "Čtenář, který si bude půjčovat knihy." required: - readerNumber - firstname - lastname - email properties: readerNumber: type: integer firstname: type: string lastname: type: string email: type: string
Address: required: - city - zipcode properties: street: type: string city: type: string zipcode: type: string format: zip-code
ReadingRoom: required: - readingRoomId - address properties: readingRoomId: type: integer address: $ref: "#/definitions/Address"
Reservation: required: - readerNumber - readingRoomId - bookId properties: readerNumber: type: integer readingRoomId: type: integer bookId: type: integer
get: tags: - users summary: searches inventory operationId: searchInventory description: | By passing in the appropriate options, you can search for available inventory in the system produces: - application/json parameters: - in: query name: searchString description: pass an optional search string for looking up inventory required: false type: string - in: query name: skip description: number of records to skip for pagination type: integer format: int32 minimum: 0 - in: query name: limit description: maximum number of records to return type: integer format: int32 minimum: 0 maximum: 50 responses: 200: description: search results matching criteria schema: type: array items: $ref: 'https://api.swaggerhub.com/domains/Tomas-Mayer/OMOLibraryDomain/1.0.0#/definitions/Book' 400: description: bad input parameter
get: tags: - users summary: searches reading room operationId: searchReadingRoom description: Return a list of reading rooms. produces: - application/json parameters: - in: query name: searchString description: pass an optional search string for looking up reding room required: false type: string - in: query name: skip description: number of records to skip for pagination type: integer format: int32 minimum: 0 - in: query name: limit description: maximum number of records to return type: integer format: int32 minimum: 0 maximum: 50 responses: 200: description: search results matching criteria schema: type: array items: $ref: 'https://api.swaggerhub.com/domains/Tomas-Mayer/OMOLibraryDomain/1.0.0#/definitions/ReadingRoom' 400: description: bad input parameter
post: tags: - users summary: adds a new reservation of book operationId: addReservation description: reserve a book for reader consumes: - application/json produces: - application/json parameters: - in: body name: reservation description: the reservation details schema: $ref: 'https://api.swaggerhub.com/domains/Tomas-Mayer/OMOLibraryDomain/1.0.0#/definitions/Reservation' responses: 201: description: item created 400: description: invalid input, object invalid 409: description: an existing item already exists
delete: tags: - users summary: removes an existing reservation of book operationId: deleteReservation description: deleta a reservation consumes: - application/json produces: - application/json parameters: - in: body name: reservation description: the reservation details schema: $ref: 'https://api.swaggerhub.com/domains/Tomas-Mayer/OMOLibraryDomain/1.0.0#/definitions/Reservation' responses: 201: description: item created 400: description: invalid input, object invalid 410: description: a requested item does not exists
post: tags: - admins summary: posts a date when the book is available in requested reading room operationId: postBookAvailability description: posts a date when the book is available in requested reading room consumes: - application/json produces: - application/json parameters: - in: body name: reservationDate schema: $ref: "#/definitions/ReservationDate" responses: 201: description: item created 400: description: invalid input, object invalid 410: description: the reservation does not exist
definitions: ReservationDate: properties: reservation: $ref: 'https://api.swaggerhub.com/domains/Tomas-Mayer/OMOLibraryDomain/1.0.0#/definitions/Reservation' date: type: string format: date