From d6c47b36852f61e6b07bd7a3edeaa636dac7594f Mon Sep 17 00:00:00 2001 From: esoe Date: Mon, 11 Nov 2024 17:57:50 +0300 Subject: [PATCH] usecase --- docs/usecase.puml | 105 +++++++++++++++--- main/api-swagger/components.yaml | 17 +++ main/api-swagger/main.yaml | 10 ++ main/api-swagger/organizations.yaml | 45 -------- main/api-swagger/paths/api.v1.accounts.yaml | 31 ++++++ .../paths/api.v1.organizations.yaml | 31 ++++++ main/api-swagger/paths/api.v1.positions.yaml | 38 +++++++ main/api-swagger/paths/hello.yaml | 7 ++ main/api-swagger/positions.yml | 50 --------- 9 files changed, 221 insertions(+), 113 deletions(-) delete mode 100644 main/api-swagger/organizations.yaml create mode 100644 main/api-swagger/paths/api.v1.accounts.yaml create mode 100644 main/api-swagger/paths/api.v1.organizations.yaml create mode 100644 main/api-swagger/paths/api.v1.positions.yaml create mode 100644 main/api-swagger/paths/hello.yaml delete mode 100644 main/api-swagger/positions.yml diff --git a/docs/usecase.puml b/docs/usecase.puml index e4072d5..9015df0 100644 --- a/docs/usecase.puml +++ b/docs/usecase.puml @@ -7,11 +7,22 @@ note top of admin : Администратор учебного центра (з actor "Монитор" as monitor note top of monitor : Заказчик, проверяющий результаты обучений и тестирований -rectangle exam-service { +' rectangle exam-service { usecase "Создание курса" as courseCreate usecase "Создание теста" as testCreate + usecase "Создание вопроса" as questionCreate + usecase "Создание ответа" as answerCreate + usecase "Создание темы" as themeCreate + usecase "Создание структуры курса" as schemeCreate + usecase "Оформление содержимого курса" as courseEdit + courseCreate <-- admin - testCreate <-- admin + testCreate <-- admin + questionCreate <-- admin + answerCreate <-- admin + schemeCreate <-- admin + themeCreate <-- admin + courseEdit <-- admin usecase "Назначение задания" as target target <-- admin @@ -20,19 +31,19 @@ rectangle exam-service { monitor --> resultsView usecase "Авторизация" as auth - rectangle "Авторизация" as examServiceAuth { + ' rectangle "Авторизация" as examServiceAuth { usecase "Внесение сведений об организации" as organization usecase "Внесение сведений о должности" as position usecase "внесение кода действующей учетной записи" as code35 auth ..> organization auth ..> position auth ..> code35 - } + ' } usecase "Просмотр перечня доступных курсов" as task usecase "Просмотр статусов о прохождении курса" as status usecase "Изучение контента курса" as learn - rectangle "Обучение" as examServiceLearn { + ' rectangle "Обучение" as examServiceLearn { usecase "Просмотр текста" as text usecase "Скачивание документов" as doc usecase "Просмотр изображений" as image @@ -42,14 +53,19 @@ rectangle exam-service { learn ..> image learn ..> video - text <.. courseCreate - doc <.. courseCreate - image <.. courseCreate - video <.. courseCreate - } + ' text <.. courseCreate + ' doc <.. courseCreate + ' image <.. courseCreate + ' video <.. courseCreate + ' } + + text <.. courseEdit + doc <.. courseEdit + image <.. courseEdit + video <.. courseEdit usecase "Прохождение проверки знаний" as test - rectangle "Проверка знаний" as examServiceTest { + ' rectangle "Проверка знаний" as examServiceTest { usecase "Просмотр вопросов и доступных ответов" as quiz usecase "Выбор ответов" as answer usecase "Отправка ответов в базу" as postAttampt @@ -57,10 +73,10 @@ rectangle exam-service { test ..> answer test ..> postAttampt - quiz <.. testCreate - answer <.. testCreate - postAttampt <.. testCreate - } + ' quiz <.. testCreate + ' answer <.. testCreate + ' postAttampt <.. testCreate + ' } user --> auth user --> task @@ -69,9 +85,62 @@ rectangle exam-service { user --> status monitor --> status - examServiceTest <.. target - examServiceLearn <.. target + usecase "Актуализация перечня организаций" as organizationsActuator + usecase "Актуализация перечня должностей" as positionsActuator + + target <-- organizationsActuator + target <-- positionsActuator + + organizationsActuator <-- admin + positionsActuator <-- admin + + + rectangle "API" as api #Pink { + usecase "/organizations" as organizations + usecase "/positions" as positions + usecase "/accounts" as accounts + usecase "/targets" as targets + usecase "/courses" as courses + usecase "/schemes" as schemes + usecase "/themes" as themes + usecase "/questions" as questions + usecase "/answers" as answers + usecase "/quizes" as quizes + usecase "/results" as results + } + + organization <.. organizations + position <.. positions + code35 <.. accounts + targets <.. target + task <.. targets + status <.. results + resultsView <.. results + + quizes <.. testCreate + target <.. testCreate + + + target <.. courseCreate + courses <.. courseCreate + themes <.. themeCreate + schemes <.. schemeCreate + + quiz <.. quizes + questions <.. questionCreate + answers <.. answerCreate + + status <.. accounts + ' results <.. accounts + + ' targets <-- courses + + + + + organizations <.. organizationsActuator + positions <.. positionsActuator @@ -80,6 +149,6 @@ rectangle exam-service { -} +' } @enduml \ No newline at end of file diff --git a/main/api-swagger/components.yaml b/main/api-swagger/components.yaml index 3334d8a..88693b8 100644 --- a/main/api-swagger/components.yaml +++ b/main/api-swagger/components.yaml @@ -26,3 +26,20 @@ components: type: integer name: type: string + accounts: + type: object + required: + - id + - code + - position + properties: + id: + type: integer + code: + type: string + position: + type: object + properties: + id: + type: integer + diff --git a/main/api-swagger/main.yaml b/main/api-swagger/main.yaml index fe255f4..f62eaa0 100644 --- a/main/api-swagger/main.yaml +++ b/main/api-swagger/main.yaml @@ -6,4 +6,14 @@ info: version: '1.0' servers: - url: http://localhost:100 +paths: + /hello: + $ref: "./paths/hello.yaml#/paths/hello" + /api/v1/positions: + $ref: "./paths/api.v1.positions.yaml#/paths/api.v1.positions" + /api/v1/organizations: + $ref: "./paths/api.v1.organizations.yaml#/paths/api.v1.organizations" + /api/v1/accounts: + $ref: "./paths/api.v1.accounts.yaml#/paths/api.v1.accounts" + diff --git a/main/api-swagger/organizations.yaml b/main/api-swagger/organizations.yaml deleted file mode 100644 index daba6b7..0000000 --- a/main/api-swagger/organizations.yaml +++ /dev/null @@ -1,45 +0,0 @@ -openapi: '3.0.3' -info: - title: exam-api - description: API for exam - termsOfService: 'http://localhost:100/hello' - version: '1.0' -servers: - - url: http://localhost:100 -paths: - /hello: - get: - responses: - '200': - description: OK - /api/v1/organizations: - get: - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: "./components.yaml#/components/schemas/organization" - description: Get all organizations - post: - summary: repo.createOrganization() Возвращает полный список организаци в базе - description: Создание новой должности - requestBody: - content: - application/json: - schema: - type: object - required: - - name - properties: - name: - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: "./components.yaml#/components/schemas/organization" - diff --git a/main/api-swagger/paths/api.v1.accounts.yaml b/main/api-swagger/paths/api.v1.accounts.yaml new file mode 100644 index 0000000..ce06139 --- /dev/null +++ b/main/api-swagger/paths/api.v1.accounts.yaml @@ -0,0 +1,31 @@ +paths: + api.v1.accounts: + get: + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/accounts" + description: Получение перечня аккаунтов + post: + summary: repo.createAccount() Создание нового аккаунта. + description: Предварительно должны быть созданы организации и должности + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/accounts" \ No newline at end of file diff --git a/main/api-swagger/paths/api.v1.organizations.yaml b/main/api-swagger/paths/api.v1.organizations.yaml new file mode 100644 index 0000000..7d18073 --- /dev/null +++ b/main/api-swagger/paths/api.v1.organizations.yaml @@ -0,0 +1,31 @@ +paths: + api.v1.organizations: + get: + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/organization" + description: Get all organizations + post: + summary: repo.createOrganization() Создает в базе запись о новой организации + description: Предварительных требований не предусмотрено + requestBody: + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/organization" \ No newline at end of file diff --git a/main/api-swagger/paths/api.v1.positions.yaml b/main/api-swagger/paths/api.v1.positions.yaml new file mode 100644 index 0000000..0331dad --- /dev/null +++ b/main/api-swagger/paths/api.v1.positions.yaml @@ -0,0 +1,38 @@ +paths: + api.v1.positions: + get: + summary: repo.find() Возвращает полный список должностей + description: Для разных организаций должности могут повторяться. Предусмотреть пагинацию при получении должностей, список может быть огромным + responses: + '200': + description: Получение списка должностей + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/position" + post: + summary: repo.create() Создает в базе запись о новой должности + description: Предварительно должна существовать организация. Должность привязываетс для каждой организации, для разных организаций должности могут повторяться. + requestBody: + content: + application/json: + schema: + type: object + required: + - name + - organization + properties: + name: + type: string + organization: + type: object + properties: + id: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: "../components.yaml#/components/schemas/position" \ No newline at end of file diff --git a/main/api-swagger/paths/hello.yaml b/main/api-swagger/paths/hello.yaml new file mode 100644 index 0000000..388d12f --- /dev/null +++ b/main/api-swagger/paths/hello.yaml @@ -0,0 +1,7 @@ +paths: + hello: + summary: Возвращает текущую страницу описания сервиса + get: + responses: + '200': + description: Справка по структуре приложения hello/main.md \ No newline at end of file diff --git a/main/api-swagger/positions.yml b/main/api-swagger/positions.yml deleted file mode 100644 index 959f426..0000000 --- a/main/api-swagger/positions.yml +++ /dev/null @@ -1,50 +0,0 @@ -openapi: '3.0.3' -info: - title: exam-api - description: API for exam - termsOfService: 'http://localhost:100/hello' - version: '1.0' -servers: - - url: http://localhost:100 -paths: - /hello: - get: - responses: - '200': - description: OK - /api/v1/positions: - get: - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: "./components.yaml#/components/schemas/position" - description: Get all positions - post: - summary: repo.create() Возвращает полный список должностей в базе - description: Создание новой должности - requestBody: - content: - application/json: - schema: - type: object - required: - - name - - organization - properties: - name: - type: string - organization: - type: object - properties: - id: - type: integer - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: "./components.yaml#/components/schemas/position"