Skip to content

Commit

Permalink
Teacher create and approve (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabudilovskiy authored Jun 8, 2023
1 parent e96adfd commit f21c4d2
Show file tree
Hide file tree
Showing 103 changed files with 2,524 additions and 162 deletions.
55 changes: 55 additions & 0 deletions .gen/objs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@ src/views/timetable/get/view.hpp
src/views/timetable/get/view.cpp
src/views/timetable/get/Responses.hpp
src/views/timetable/get/Request.hpp
src/views/teacher/request/list/view.hpp
src/views/teacher/request/list/view.cpp
src/views/teacher/request/list/Responses.hpp
src/views/teacher/request/list/Request.hpp
src/views/teacher/request/approve/new/view.hpp
src/views/teacher/request/approve/new/view.cpp
src/views/teacher/request/approve/new/Responses.hpp
src/views/teacher/request/approve/new/Request.hpp
src/views/teacher/request/approve/link/view.hpp
src/views/teacher/request/approve/link/view.cpp
src/views/teacher/request/approve/link/Responses.hpp
src/views/teacher/request/approve/link/Request.hpp
src/views/teacher/list/view.hpp
src/views/teacher/list/view.cpp
src/views/teacher/list/Responses.hpp
src/views/teacher/list/Request.hpp
src/views/teacher/create/view.hpp
src/views/teacher/create/view.cpp
src/views/teacher/create/Responses.hpp
src/views/teacher/create/Request.hpp
src/views/register/view.hpp
src/views/register/view.cpp
src/views/register/Responses.hpp
Expand All @@ -16,6 +32,14 @@ src/views/login/Responses.hpp
src/views/login/Request.hpp
src/views/hello/view.hpp
src/views/hello/view.cpp
src/views/group-stage/list/view.hpp
src/views/group-stage/list/view.cpp
src/views/group-stage/list/Responses.hpp
src/views/group-stage/list/Request.hpp
src/views/faculty/list/view.hpp
src/views/faculty/list/view.cpp
src/views/faculty/list/Responses.hpp
src/views/faculty/list/Request.hpp
src/views/admin/list/view.hpp
src/views/admin/list/view.cpp
src/views/admin/list/Responses.hpp
Expand All @@ -27,6 +51,8 @@ src/views/admin/create/Request.hpp
src/utils/type_holder.hpp
src/utils/shared_transaction.hpp
src/utils/postgres_helper.hpp
src/utils/perform_common_errors.hpp
src/utils/perform_common_errors.cpp
src/utils/parse/uuid/string.hpp
src/utils/parse/uuid/string.cpp
src/utils/meta.hpp
Expand All @@ -48,6 +74,7 @@ src/utils/convert/base.hpp
src/utils/convert/additional_properties.hpp
src/utils/constexpr_string.hpp
src/utils/component_list_fwd.hpp
src/utils/common_errors.hpp
src/models/user_type/type.hpp
src/models/user_type/serialize.hpp
src/models/user_type/serialize.cpp
Expand All @@ -69,6 +96,10 @@ src/models/timestring/parse.hpp
src/models/timestring/parse.cpp
src/models/timestring/fwd.hpp
src/models/timestring/all.hpp
src/models/teacher_info/type.hpp
src/models/teacher_info/serialize.hpp
src/models/teacher_info/postgre.hpp
src/models/teacher_info/parse.hpp
src/models/teacher_filter/type.hpp
src/models/teacher_filter/postgre.hpp
src/models/teacher_filter/fwd.hpp
Expand All @@ -91,6 +122,8 @@ src/models/subgroup/postgre.hpp
src/models/subgroup/parse.hpp
src/models/subgroup/parse.cpp
src/models/subgroup/all.hpp
src/models/request_privileges/type.hpp
src/models/request_privileges/fwd.hpp
src/models/register_request/type.hpp
src/models/register_request/fwd.hpp
src/models/lesson_week_type/type.hpp
Expand All @@ -114,6 +147,18 @@ src/models/lesson_type/all.hpp
src/models/lesson_filter/type.hpp
src/models/lesson_filter/postgre.hpp
src/models/lesson_filter/fwd.hpp
src/models/group_stage_filter/type.hpp
src/models/group_stage_filter/postgre.hpp
src/models/group_stage_filter/fwd.hpp
src/models/group_stage/type.hpp
src/models/group_stage/postgre.hpp
src/models/group_stage/fwd.hpp
src/models/faculty_filter/type.hpp
src/models/faculty_filter/postgre.hpp
src/models/faculty_filter/fwd.hpp
src/models/faculty/type.hpp
src/models/faculty/postgre.hpp
src/models/faculty/fwd.hpp
src/models/education_type/type.hpp
src/models/education_type/serialize.hpp
src/models/education_type/serialize.cpp
Expand Down Expand Up @@ -159,6 +204,16 @@ src/components/controllers/postgres/lesson/fwd.hpp
src/components/controllers/postgres/lesson/fwd.cpp
src/components/controllers/postgres/lesson/controller.hpp
src/components/controllers/postgres/lesson/controller.cpp
src/components/controllers/postgres/group_stage/sql_queries.hpp
src/components/controllers/postgres/group_stage/fwd.hpp
src/components/controllers/postgres/group_stage/fwd.cpp
src/components/controllers/postgres/group_stage/controller.hpp
src/components/controllers/postgres/group_stage/controller.cpp
src/components/controllers/postgres/faculty/sql_queries.hpp
src/components/controllers/postgres/faculty/fwd.hpp
src/components/controllers/postgres/faculty/fwd.cpp
src/components/controllers/postgres/faculty/controller.hpp
src/components/controllers/postgres/faculty/controller.cpp
src/components/controllers/postgres/admin/sql_queries.hpp
src/components/controllers/postgres/admin/fwd.hpp
src/components/controllers/postgres/admin/fwd.cpp
Expand Down
4 changes: 4 additions & 0 deletions api/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ info:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: root
description: Доступно суперпользователю
- name: admins
description: Доступно администраторам сервиса
- name: teachers
Expand All @@ -24,3 +26,5 @@ paths:
$ref: 'views/admin/create/view.yaml'
/admin/list:
$ref: 'views/admin/list/view.yaml'
/teacher/create:
$ref: 'views/teacher/create/view.yaml'
9 changes: 9 additions & 0 deletions api/types/TeacherInfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
properties:
fio:
type: string
description: ФИО
bio:
type: string
description: биография
department_id:
$ref: Id.yaml
2 changes: 1 addition & 1 deletion api/views/admin/create/view.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
post:
description: Получить список администраторов
tags:
- admins
- root
requestBody:
required: true
content:
Expand Down
2 changes: 1 addition & 1 deletion api/views/admin/list/view.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
post:
description: Получить список администраторов
tags:
- admins
- root
requestBody:
required: true
content:
Expand Down
3 changes: 3 additions & 0 deletions api/views/teacher/create/Request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
properties:
credentials:
$ref: ../../../types/TeacherInfo.yaml
35 changes: 35 additions & 0 deletions api/views/teacher/create/view.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
post:
description: Создать нового преподавателя
tags:
- admins
requestBody:
required: true
content:
application/json:
schema:
$ref: 'Request.yaml'
parameters:
- in: header
name: authToken
required: true
schema:
$ref: '../../../types/AuthTokenV1.yaml'
responses:
'200':
description: Преподаватель успешно создан
content:
application/json:
schema:
$ref: '../../../types/AdminAccount.yaml'
'401':
description: Отсутствует или истекший токен
content:
application/json:
schema:
$ref: '../../../types/ErrorV1.yaml'
'403':
description: Нет прав на подобные изменения
content:
application/json:
schema:
$ref: '../../../types/ErrorV1.yaml'
5 changes: 5 additions & 0 deletions api/views/teacher/requests/approve/link/Request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
properties:
teacher_id:
$ref: ../../../../../types/Id.yaml
request_id:
$ref: ../../../../../types/Id.yaml
35 changes: 35 additions & 0 deletions api/views/teacher/requests/approve/link/view.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
post:
description: Принять запрос на повышение прав до преподавателя
tags:
- admins
requestBody:
required: true
content:
application/json:
schema:
$ref: 'Request.yaml'
parameters:
- in: header
name: authToken
required: true
schema:
$ref: '../../../types/AuthTokenV1.yaml'
responses:
'200':
description: Преподаватель успешно создан
content:
application/json:
schema:
$ref: '../../../types/AdminAccount.yaml'
'401':
description: Отсутствует или истекший токен
content:
application/json:
schema:
$ref: '../../../types/ErrorV1.yaml'
'403':
description: Нет прав на подобные изменения
content:
application/json:
schema:
$ref: '../../../types/ErrorV1.yaml'
30 changes: 28 additions & 2 deletions configs/static_config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,39 @@ components_manager:
handler-teacher-list:
path: /teacher/list
method: POST
task_processor: main-task-processor
task_processor: main-task-processor
handler-faculty-list:
path: /faculty/list
method: POST
task_processor: main-task-processor
handler-teacher-requests-list:
path: /teacher/requests/list
method: POST
task_processor: main-task-processor
handler-teacher-requests-approve-link:
path: /teacher/requests/approve/link
method: POST
task_processor: main-task-processor
handler-teacher-requests-approve-new:
path: /teacher/requests/approve/new
method: POST
task_processor: main-task-processor
handler-teacher-create:
path: /teacher/create
method: POST
task_processor: main-task-processor
handler-group-stage-list:
path: /group-stage/list
method: POST
task_processor: main-task-processor
postgres-db-1:
dbconnection: $dbconnection
blocking_task_processor: fs-task-processor
dns_resolver: async
sync-start: true
admin_controller: {}
admin_controller: {}
group_stage_controller: {}
faculty_controller: {}
user-controller:
root:
login: $root_login
Expand Down
4 changes: 2 additions & 2 deletions postgresql/data/initial_data_timetable1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ INSERT INTO timetable_vsu.teacher (id, fio, bio, id_department)
VALUES ('241416c7-9654-4814-b36b-7d39c1ddded2', 'John Doe', 'Professor of Mathematics', '1f93ceb4-d931-4b66-a0e5-7323d6b60f3b');

-- Insert test data into the group table
INSERT INTO timetable_vsu.group (id, name, type)
VALUES ('c1fb3eac-de6d-44ef-bf35-18bebe832e1d', 'MM-21', 'magistracy');
INSERT INTO timetable_vsu.group (id, name, type, id_faculty)
VALUES ('c1fb3eac-de6d-44ef-bf35-18bebe832e1d', 'MM-21', 'magistracy', 'bbc6312c-f25e-4db3-b2a0-3f5dc6717a8d');

-- Insert test data into the group_stage table
INSERT INTO timetable_vsu.group_stage (id, begin, "end", course, id_group)
Expand Down
4 changes: 2 additions & 2 deletions postgresql/data/initial_data_timetable2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ INSERT INTO timetable_vsu.teacher (id, fio, bio, id_department)
VALUES ('dc5bad6f-fcf6-4869-b0e5-5c36aed85cc1', 'УСКОВА О.Ф.', 'ЛУЧШИЙ ПРЕПОД МИРА', '3ec37598-6c49-4a02-8134-d9dbffafa8c4');

-- Insert test data into the group table
INSERT INTO timetable_vsu.group (id, name, type)
VALUES ('c8a34f05-f081-4d78-b971-30d562fd9f1c', '62', 'undergraduate');
INSERT INTO timetable_vsu.group (id, name, type, id_faculty)
VALUES ('c8a34f05-f081-4d78-b971-30d562fd9f1c', '62', 'undergraduate', 'af8f26b8-afc7-483d-b6cc-ffaec29d4bc7');

-- Insert test data into the group_stage table
INSERT INTO timetable_vsu.group_stage (id, begin, "end", course, id_group)
Expand Down
Loading

0 comments on commit f21c4d2

Please sign in to comment.