openapi: '3.0.2' info: title: API Restobook version: '1.0' license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - url: https://restobook.fun tags: - name: restaurant description: Действия над ресторанами - name: employee description: Действия над сотрудниками ресторанов - name: table description: Действия над столами - name: reservation description: Действия над бронями - name: auth description: действия с аутентификацией security: - vendor-admin: [] - restobook-employee: [] paths: /restobook-api/restaurant: post: operationId: createRestaurant tags: - restaurant summary: Создать ресторан requestBody: content: application/json: schema: type: object properties: name: type: string example: Ресторан для студентов legalEntityName: type: string example: ООО Накормим студентов inn: type: string example: '991154917952' comment: type: string example: Да, мы существуем и кормим студентов только лучшей едой! required: true responses: 201: description: Ресторан создан content: application/json: schema: type: object properties: id: type: integer example: 1 name: type: string example: "Ресторан для студентов" legalEntityName: type: string example: "ООО Вкусно и точка" inn: type: string example: "291154917953" comment: type: string example: "Да, мы существуем и кормим студентов только лучшей едой!" 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором вендора или администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" get: operationId: getRestaurants tags: - restaurant summary: Получить список всех ресторанов responses: 200: description: Данные о всех ресторанах получены content: application/json: schema: type: array items: $ref: "#/components/schemas/Restaurant" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором вендора content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/restaurant/{restaurantId}: get: operationId: getRestaurant tags: - restaurant summary: Получить ресторан по идентификатору parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer responses: 200: description: Данные о нужном ресторане content: application/json: schema: $ref: "#/components/schemas/Restaurant" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" put: operationId: updateRestaurant tags: - restaurant summary: Изменить данные о ресторане по идентификатору parameters: - name: restaurantId in: path description: Идентификатор изменяемого ресторана required: true schema: type: integer requestBody: content: application/json: schema: $ref: "#/components/schemas/Restaurant" responses: 200: description: Данные о нужном ресторане изменены content: application/json: schema: $ref: "#/components/schemas/Restaurant" 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера delete: operationId: deleteRestaurant tags: - restaurant summary: Удалить ресторан по идентификатору parameters: - name: restaurantId in: path description: Идентификатор удаляемого ресторана required: true schema: type: integer responses: 204: description: Данные о нужном ресторане удалены 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера /restobook-api/restaurant/{restaurantId}/employee: post: operationId: createEmployee tags: - employee summary: Создать нового сотрудника в ресторане restaurantId parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: login: type: string example: "putin" name: type: string example: "Павел" surname: type: string example: "Путин" patronymic: type: string example: "Александрович" comment: type: string example: "Самый главный админ" restaurantId: type: integer example: 1 password: type: string example: qwerty role: type: string example: restobook_admin responses: 201: description: Сотрудник создан content: application/json: schema: $ref: "#/components/schemas/EmployeeResponse" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором вендора или администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" get: operationId: getEmployees tags: - employee summary: Получить всех сотрудников в ресторане restaurantId parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer responses: 200: description: Данные о всех сотрудниках ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/EmployeeResponse" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/restaurant/{restaurantId}/employee/{employeeId}: get: operationId: getEmployee tags: - employee summary: Получить данные об определённом сотруднике parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer - name: employeeId in: path description: Идентификатор получаемого сотрудника required: true schema: type: integer responses: 200: description: Данные о нужном сотруднике content: application/json: schema: $ref: "#/components/schemas/EmployeeResponse" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или сотрудник не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера put: operationId: updateEmployee tags: - employee summary: Изменить данные об определённом сотруднике parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer - name: employeeId in: path description: Идентификатор получаемого сотрудника required: true schema: type: integer requestBody: content: application/json: schema: $ref: "#/components/schemas/Employee" responses: 200: description: Данные о нужном сотруднике изменены content: application/json: schema: $ref: "#/components/schemas/EmployeeResponse" 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или сотрудник не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера delete: operationId: deleteEmployee tags: - employee summary: Удалить данные об определённом сотруднике parameters: - name: restaurantId in: path description: Идентификатор удаляемого ресторана required: true schema: type: integer - name: employeeId in: path description: Идентификатор удаляемого сотрудника required: true schema: type: integer responses: 204: description: Данные о нужном сотруднике удалены 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или сотрудник не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера /restobook-api/restaurant/{restaurantId}/table: post: operationId: createTable tags: - table summary: Добавить стол parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: number: type: integer example: 1 seatsNumber: type: integer example: 5 state: type: string example: "NORMAL" restaurantId: type: integer example: 1 responses: 201: description: Стол создан content: application/json: schema: type: object properties: id: type: integer example: 1 number: type: integer example: 1 seatsNumber: type: integer example: 5 state: type: string example: "NORMAL" comment: type: string example: null restaurantId: type: integer example: 1 reservationIds: type: array items: type: integer example: [] 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" get: operationId: getTables tags: - table summary: Получить все столы в ресторане restaurantId parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer responses: 200: description: Данные о всех столах ресторана restaurantId content: application/json: schema: type: array items: $ref: "#/components/schemas/Table" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка на сервере content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/restaurant/{restaurantId}/table/{tableId}: get: operationId: getTable tags: - table summary: Получить данные об определённом столе parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer - name: tableId in: path description: Идентификатор получаемого стола required: true schema: type: integer responses: 200: description: Данные о нужном столе content: application/json: schema: type: array items: $ref: "#/components/schemas/Table" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или стол не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка на сервере content: application/json: schema: $ref: "#/components/schemas/Error" put: operationId: updateTable tags: - table summary: Изменить данные об определённом столе parameters: - name: restaurantId in: path description: Идентификатор получаемого ресторана required: true schema: type: integer - name: tableId in: path description: Идентификатор получаемого стола required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: id: type: integer example: 2 number: type: integer example: 1 seatsNumber: type: integer example: 5 state: type: string example: BROKEN responses: 200: description: Данные о нужном столе изменены content: application/json: schema: type: object properties: id: type: integer example: 2 number: type: integer example: 1 seatsNumber: type: integer example: 5 state: type: string example: BROKEN comment: type: string example: null restaurantId: type: integer example: 2 reservationIds: type: array items: type: integer example: [] 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или стол не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteTable tags: - table summary: Удалить данные об определённом столе parameters: - name: restaurantId in: path description: Идентификатор удаляемого ресторана required: true schema: type: integer - name: tableId in: path description: Идентификатор удаляемого стола required: true schema: type: integer responses: 204: description: Данные о нужном столе удалены 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или стол не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/restaurant/{restaurantId}/reservation: post: operationId: createReservation tags: - reservation summary: Добавить бронь parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: personsNumber: type: integer example: 3 clientPhoneNumber: type: string example: "79010973250" clientName: type: string example: "Павел" startDateTime: type: string example: "2024-06-03T05:23:00Z" durationIntervalMinutes: type: integer example: 45 employeeFullName: type: string example: "Фролов Макар" comment: type: string example: null tableIds: type: array items: type: integer example: [5] responses: 201: description: Бронь создана content: application/json: schema: type: object properties: id: type: integer example: 4 personsNumber: type: integer example: 3 clientPhoneNumber: type: integer example: "79010973250" clientName: type: integer example: "Павел" startDateTime: type: integer example: "2024-06-03T05:23:00Z" durationIntervalMinutes: type: integer example: 45 employeeFullName: type: integer example: "Фролов Макар" creatingDateTime: type: integer example: "2024-06-03T05:23:01.991595461Z" state: type: integer example: "WAITING" comment: type: integer example: null restaurantId: type: integer example: 2 tableIds: type: integer items: type: integer example: [5] 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" get: operationId: getReservations tags: - reservation summary: Получить все брони в ресторане restaurantId parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer - name: dateTime in: query description: Выбранное время required: false schema: type: string example: "2024-05-27T04:20:12.410408Z" responses: 200: description: Данные о всех бронях ресторана restaurantId content: application/json: schema: type: array items: $ref: "#/components/schemas/Reservation" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка на сервере content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/restaurant/{restaurantId}/reservation/{reservationId}: get: operationId: getReservation tags: - reservation summary: Получить данные об определённом брони parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer - name: reservationId in: path description: Идентификатор получаемой брони required: true schema: type: integer responses: 200: description: Данные о нужной брони content: application/json: schema: $ref: "#/components/schemas/Reservation" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан не найден content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка на сервере content: application/json: schema: $ref: "#/components/schemas/Error" put: operationId: updateReservation tags: - reservation summary: Изменить данные об определённой брони parameters: - name: restaurantId in: path description: Идентификатор ресторана required: true schema: type: integer - name: reservationId in: path description: Идентификатор изменяемой брони required: true schema: type: integer requestBody: content: application/json: schema: type: object properties: id: type: integer example: 4 personsNumber: type: integer example: 3 clientPhoneNumber: type: string example: "79010973250" clientName: type: string example: "Павел" startDateTime: type: string example: "2024-06-03T05:23:00Z" durationIntervalMinutes: type: integer example: 45 employeeFullName: type: string example: "Фролов Макар" creatingDateTime: type: string example: "2024-06-03T05:23:01.991595461Z" state: type: string example: "OPEN" comment: type: string example: null restaurantId: type: integer example: 2 tableIds: type: integer example: [6] responses: 200: description: Данные о нужной брони изменены content: application/json: schema: type: object properties: id: type: integer example: 4 personsNumber: type: integer example: 3 clientPhoneNumber: type: string example: "79010973250" clientName: type: string example: "Павел" startDateTime: type: string example: "2024-06-03T05:23:00Z" durationIntervalMinutes: type: integer example: 45 employeeFullName: type: string example: "Фролов Макар" creatingDateTime: type: string example: "2024-06-03T05:23:01.991595Z" state: type: string example: "OPEN" comment: type: string example: null restaurantId: type: integer example: 2 tableIds: type: array items: type: integer example: [6] 400: description: Данные запроса не прошли валидацию на сервере content: application/json: schema: $ref: "#/components/schemas/Error" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или бронь не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" delete: operationId: deleteReservation tags: - reservation summary: Удалить данные об определённой брони parameters: - name: restaurantId in: path description: Идентификатор удаляемого ресторана required: true schema: type: integer - name: reservationId in: path description: Идентификатор удаляемой брони required: true schema: type: integer responses: 204: description: Данные о нужной брони удалены 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 403: description: Клиент не является администратором ресторана restaurantId content: application/json: schema: $ref: "#/components/schemas/Error" 404: description: Ресторан или бронь не найдены content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/auth/me: get: operationId: getMe summary: Получить информацию об аутентифицированном пользователе tags: - auth responses: 200: description: Информация об аутентифицированном пользователе content: application/json: schema: $ref: "#/components/schemas/EmployeeResponse" 401: description: Клиент не аутентифицирован content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка сервера content: application/json: schema: $ref: "#/components/schemas/Error" /restobook-api/auth/password: put: operationId: changePassword tags: - auth summary: Изменить пароль сотрудника requestBody: content: application/json: schema: type: object properties: oldPassword: type: string example: qwerty newPassword: type: string example: str0ngP4ssw0rd responses: 204: description: пароль успешно изменён 401: description: не удалось сменить пароль content: application/json: schema: $ref: "#/components/schemas/Error" 500: description: Ошибка на сервере content: application/json: schema: $ref: "#/components/schemas/Error" components: securitySchemes: vendor-admin: type: oauth2 flows: password: scopes: all: "Все возможные действия" tokenUrl: https://restobook.fun/realms/master/protocol/openid-connect/token restobook-employee: type: oauth2 flows: password: scopes: all: "Все возможные действия" tokenUrl: https://restobook.fun/realms/restaurant/protocol/openid-connect/token schemas: Restaurant: type: object properties: id: type: integer example: 1 name: type: string example: Ресторан для студентов legalEntityName: type: string example: ООО Накормим студентов inn: type: string example: '291154917953' comment: type: string example: Да, мы существуем и кормим студентов только лучшей едой! Employee: type: object properties: id: type: integer example: 1 login: type: string example: putin surname: type: string example: Путин name: type: string example: Павел patronymic: type: string example: Александрович comment: type: string changedPassword: type: boolean example: false restaurantId: type: integer example: 1 EmployeeResponse: type: object properties: id: type: integer example: 1 login: type: string example: "putin" surname: type: string example: "Путин" name: type: string example: "Павел" password: type: string example: null role: type: string example: null patronymic: type: string example: null comment: type: string example: null changedPassword: type: string example: false restaurantId: type: integer example: 1 Table: type: object properties: id: type: integer number: type: integer seatsNumber: type: integer state: type: string restaurantId: type: integer reservationIds: type: array items: type: integer Reservation: type: object properties: id: type: integer personsNumber: type: integer clientPhoneNumber: type: string clientName: type: string startDateTime: type: string durationIntervalMinutes: type: integer employeeFullName: type: string creatingDateTime: type: string state: type: string comment: type: string restaurantId: type: integer tableIds: type: array items: type: integer Error: type: object properties: dateTime: type: string messages: type: array items: type: string