Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
sabudilovskiy committed Oct 25, 2023
1 parent 72f8814 commit 74820eb
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 131 deletions.
4 changes: 0 additions & 4 deletions .gen/objs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ src/legacy/models/substring/parse.cpp
src/legacy/models/substring/fwd.hpp
src/legacy/models/substring/all.hpp
src/legacy/models/subgroup/type.hpp
src/legacy/models/subgroup/serialize.hpp
src/legacy/models/subgroup/serialize.cpp
src/legacy/models/subgroup/postgre.hpp
src/legacy/models/subgroup/parse.hpp
src/legacy/models/subgroup/parse.cpp
src/legacy/models/subgroup/all.hpp
src/legacy/models/request_privileges/type.hpp
src/legacy/models/request_privileges/fwd.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <algorithm>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <openapi/json/serialize/enum.hpp>
#include <optional>
#include <type_traits>
#include <userver/components/component_context.hpp>
Expand All @@ -22,7 +23,6 @@
#include "legacy/models/admin_account/postgre.hpp"
#include "legacy/models/admin_account/type.hpp"
#include "legacy/models/admin_filter/postgre.hpp"
#include "legacy/models/subgroup/serialize.hpp"
#include "legacy/models/user_credentials/postgre.hpp"
#include "sql_queries.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <exception>
#include <openapi/json/serialize/enum.hpp>
#include <optional>
#include <type_traits>
#include <userver/components/component_context.hpp>
Expand All @@ -27,7 +28,6 @@
#include "legacy/models/faculty/type.hpp"
#include "legacy/models/faculty_filter/postgre.hpp"
#include "legacy/models/request_privileges/type.hpp"
#include "legacy/models/subgroup/serialize.hpp"
#include "legacy/models/substring/postgre.hpp"
#include "legacy/models/user_credentials/postgre.hpp"
#include "sql_queries.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <exception>
#include <openapi/json/serialize/enum.hpp>
#include <optional>
#include <type_traits>
#include <userver/components/component_context.hpp>
Expand All @@ -27,7 +28,6 @@
#include "legacy/models/group_stage/type.hpp"
#include "legacy/models/group_stage_filter/postgre.hpp"
#include "legacy/models/request_privileges/type.hpp"
#include "legacy/models/subgroup/serialize.hpp"
#include "legacy/models/substring/postgre.hpp"
#include "legacy/models/user_credentials/postgre.hpp"
#include "sql_queries.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <openapi/json/serialize/enum.hpp>
#include <optional>
#include <type_traits>
#include <userver/components/component_context.hpp>
Expand All @@ -21,7 +22,6 @@
#include "legacy/models/lesson_filter/postgre.hpp"
#include "legacy/models/lesson_v1/postgre.hpp"
#include "legacy/models/lesson_v1/type.hpp"
#include "legacy/models/subgroup/serialize.hpp"
#include "sql_queries.hpp"

namespace legacy::components::controllers::postgres::lesson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <exception>
#include <openapi/json/serialize/enum.hpp>
#include <optional>
#include <type_traits>
#include <userver/components/component_context.hpp>
Expand All @@ -25,7 +26,6 @@
#include "legacy/models/admin_account/postgre.hpp"
#include "legacy/models/admin_filter/postgre.hpp"
#include "legacy/models/request_privileges/type.hpp"
#include "legacy/models/subgroup/serialize.hpp"
#include "legacy/models/substring/postgre.hpp"
#include "legacy/models/teacher/postgre.hpp"
#include "legacy/models/teacher_filter/postgre.hpp"
Expand Down
7 changes: 5 additions & 2 deletions src/legacy/models/lesson_type/postgre.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
namespace userver::storages::postgres::io
{
template <>
struct CppToUserPg<::legacy::models::LessonType> : openapi::PgMapper<::legacy::models::LessonType, "timetable_vsu.type_lesson">
{};
struct CppToUserPg<::legacy::models::LessonType>
: openapi::PgMapper<::legacy::models::LessonType,
"timetable_vsu.type_lesson">
{
};
} // namespace userver::storages::postgres::io
1 change: 0 additions & 1 deletion src/legacy/models/lesson_v1/parse.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <openapi/json/parse/enum.hpp>

#include "legacy/models/subgroup/parse.hpp"
#include "legacy/models/timestring/parse.hpp"
#include "type.hpp"
1 change: 0 additions & 1 deletion src/legacy/models/lesson_v1/serialize.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <openapi/json/serialize/enum.hpp>

#include "legacy/models/subgroup/serialize.hpp"
#include "legacy/models/timestring/serialize.hpp"
#include "type.hpp"
2 changes: 0 additions & 2 deletions src/legacy/models/subgroup/all.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#pragma once
#include "legacy/models/subgroup/parse.hpp"
#include "legacy/models/subgroup/postgre.hpp"
#include "legacy/models/subgroup/serialize.hpp"
42 changes: 0 additions & 42 deletions src/legacy/models/subgroup/parse.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions src/legacy/models/subgroup/parse.hpp

This file was deleted.

18 changes: 4 additions & 14 deletions src/legacy/models/subgroup/postgre.hpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
#pragma once
#include <userver/storages/postgres/io/enum_types.hpp>
#include <userver/storages/postgres/io/type_mapping.hpp>
#include <userver/utils/trivial_map.hpp>
#include <openapi/enum/pg_mapper.hpp>

#include "type.hpp"

namespace userver::storages::postgres::io
{
using ::legacy::models::Subgroup;
template <>
struct CppToUserPg<Subgroup> : EnumMappingBase<Subgroup>
struct CppToUserPg<::legacy::models::Subgroup>
: openapi::PgMapper<::legacy::models::Subgroup, "timetable_vsu.subgroup">
{
static constexpr userver::storages::postgres::DBTypeName postgres_name =
"timetable_vsu.subgroup";
static constexpr userver::utils::TrivialBiMap enumerators =
[](auto selector) {
return selector()
.Case("all", Subgroup::kAll)
.Case("first", Subgroup::kFirst)
.Case("second", Subgroup::kSecond);
};
};

} // namespace userver::storages::postgres::io
28 changes: 0 additions & 28 deletions src/legacy/models/subgroup/serialize.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions src/legacy/models/subgroup/serialize.hpp

This file was deleted.

8 changes: 2 additions & 6 deletions src/legacy/models/subgroup/type.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#pragma once

#include <openapi/enum/declare.hpp>
namespace legacy::models
{
enum struct Subgroup
{
kAll,
kFirst,
kSecond
};
DECLARE_OPENAPI_ENUM(Subgroup, int, all, first, second);
}

0 comments on commit 74820eb

Please sign in to comment.