generated from userver-framework/service_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74820eb
commit c18a357
Showing
27 changed files
with
573 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
#pragma once | ||
|
||
#include <boost/uuid/uuid.hpp> | ||
#include <userver/components/loggable_component_base.hpp> | ||
#include <utils/component_list_fwd.hpp> | ||
#include <utils/pg_controller.hpp> | ||
#include <utils/shared_transaction.hpp> | ||
|
||
#include "models/lesson_filter/type.hpp" | ||
#include "models/lesson_v1/type.hpp" | ||
|
||
namespace controllers::lesson | ||
{ | ||
using Base = utils::PgController<"new-lesson-controller", "postgres-db-1">; | ||
struct Controller : Base | ||
{ | ||
Controller(const userver::components::ComponentConfig& cfg, | ||
const userver::components::ComponentContext& ctx); | ||
boost::uuids::uuid CreateNew( | ||
const boost::uuids::uuid& id_user, | ||
std::vector<models::LessonV1> FindLessons( | ||
const std::optional<models::LessonFilter>& filter, | ||
utils::SharedTransaction transaction = nullptr) const; | ||
}; | ||
} // namespace controllers::lesson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <legacy/models/substring/type.hpp> | ||
#include <openapi/doc/base.hpp> | ||
#include <type_traits> | ||
namespace openapi | ||
{ | ||
inline void Append(DocHelper doc_helper, | ||
std::type_identity<legacy::models::SubString>) | ||
{ | ||
doc_helper.cur_place["type"] = "string"; | ||
} | ||
} // namespace openapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
#include <openapi/enum/pg_mapper.hpp> | ||
#include <userver/storages/postgres/io/pg_types.hpp> | ||
|
||
#include "type.hpp" | ||
|
||
namespace userver::storages::postgres::io | ||
{ | ||
template <> | ||
struct CppToUserPg<::models::LessonFilter> | ||
{ | ||
static constexpr DBTypeName postgres_name = | ||
"timetable_vsu.lesson_filter_v2"; | ||
}; | ||
|
||
} // namespace userver::storages::postgres::io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
#include <openapi/base/properties/datetime.hpp> | ||
#include <openapi/base/property_base.hpp> | ||
#include <openapi/types/datetime.hpp> | ||
#include <openapi/types/optional.hpp> | ||
#include <vector> | ||
|
||
#include "legacy/models/day/type.hpp" | ||
#include "legacy/models/education_type/type.hpp" | ||
#include "legacy/models/lesson_type/type.hpp" | ||
#include "legacy/models/lesson_week_type/type.hpp" | ||
#include "legacy/models/subgroup/type.hpp" | ||
#include "legacy/models/substring/type.hpp" | ||
|
||
namespace models | ||
{ | ||
using namespace openapi::types; | ||
using namespace openapi::preferences; | ||
|
||
struct LessonFilter | ||
{ | ||
Optional<std::vector<legacy::models::SubString>, Name<"lesson_ids">> | ||
lesson_ids; | ||
Optional<Datetime<>, Name<"begin">> begin; | ||
Optional<Datetime<>, Name<"end">> end; | ||
Optional<std::vector<legacy::models::Day>, Name<"days">> days; | ||
Optional<std::vector<legacy::models::SubString>, Name<"department_ids">> | ||
department_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"department_names">> | ||
department_names; | ||
Optional<std::vector<legacy::models::SubString>, Name<"faculty_ids">> | ||
faculty_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"faculty_names">> | ||
faculty_names; | ||
Optional<std::vector<legacy::models::SubString>, Name<"group_ids">> | ||
group_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"group_names">> | ||
group_names; | ||
Optional<std::vector<short>, Name<"group_courses">> group_courses; | ||
Optional<std::vector<legacy::models::EducationType>, Name<"group_types">> | ||
group_types; | ||
Optional<std::vector<legacy::models::SubString>, Name<"room_ids">> room_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"room_names">> | ||
room_names; | ||
Optional<legacy::models::Subgroup, Name<"subgroup">> subgroup; | ||
Optional<std::vector<legacy::models::SubString>, Name<"subject_ids">> | ||
subject_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"subject_names">> | ||
subject_names; | ||
Optional<std::vector<legacy::models::SubString>, Name<"teacher_ids">> | ||
teacher_ids; | ||
Optional<std::vector<legacy::models::SubString>, Name<"teacher_fios">> | ||
teacher_fios; | ||
Optional<std::vector<legacy::models::SubString>, Name<"teacher_bios">> | ||
teacher_bios; | ||
Optional<legacy::models::LessonWeekType, Name<"week_type">> week; | ||
Optional<legacy::models::LessonType, Name<"lesson_type">> type; | ||
Optional<std::vector<short>, Name<"numbers">> numbers; | ||
auto operator<=>(const LessonFilter&) const = default; | ||
}; | ||
} // namespace models |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.