Skip to content

Commit

Permalink
move legacy models, components and views
Browse files Browse the repository at this point in the history
  • Loading branch information
sabudilovskiy committed Oct 16, 2023
1 parent 52c7381 commit 6614d06
Show file tree
Hide file tree
Showing 229 changed files with 1,044 additions and 1,058 deletions.
382 changes: 191 additions & 191 deletions .gen/objs.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion benchs/hello_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <string_view>
#include <userver/engine/run_standalone.hpp>

#include "views/hello/view.hpp"
#include "legacy/views/hello/view.hpp"

void HelloBenchmark(benchmark::State& state)
{
Expand Down
43 changes: 22 additions & 21 deletions service/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
#include <userver/utils/daemon_run.hpp>
#include <utility>

#include "components/controllers/postgres/admin/fwd.hpp"
#include "components/controllers/postgres/faculty/fwd.hpp"
#include "components/controllers/postgres/group_stage/fwd.hpp"
#include "components/controllers/postgres/lesson/fwd.hpp"
#include "components/controllers/postgres/teacher/fwd.hpp"
#include "components/controllers/postgres/token/fwd.hpp"
#include "components/controllers/postgres/user/fwd.hpp"
#include "views/admin/create/view.hpp"
#include "views/admin/list/view.hpp"
#include "views/faculty/list/view.hpp"
#include "views/group-stage/list/view.hpp"
#include "views/hello/view.hpp"
#include "views/login/view.hpp"
#include "views/register/view.hpp"
#include "views/teacher/create/view.hpp"
#include "views/teacher/list/view.hpp"
#include "views/teacher/request/approve/link/view.hpp"
#include "views/teacher/request/approve/new/view.hpp"
#include "views/teacher/request/list/view.hpp"
#include "legacy/components/controllers/postgres/admin/fwd.hpp"
#include "legacy/components/controllers/postgres/faculty/fwd.hpp"
#include "legacy/components/controllers/postgres/group_stage/fwd.hpp"
#include "legacy/components/controllers/postgres/lesson/fwd.hpp"
#include "legacy/components/controllers/postgres/teacher/fwd.hpp"
#include "legacy/components/controllers/postgres/token/fwd.hpp"
#include "legacy/components/controllers/postgres/user/fwd.hpp"
#include "legacy/views/admin/create/view.hpp"
#include "legacy/views/admin/list/view.hpp"
#include "legacy/views/faculty/list/view.hpp"
#include "legacy/views/group-stage/list/view.hpp"
#include "legacy/views/hello/view.hpp"
#include "legacy/views/login/view.hpp"
#include "legacy/views/register/view.hpp"
#include "legacy/views/teacher/create/view.hpp"
#include "legacy/views/teacher/list/view.hpp"
#include "legacy/views/teacher/request/approve/link/view.hpp"
#include "legacy/views/teacher/request/approve/new/view.hpp"
#include "legacy/views/teacher/request/list/view.hpp"
#include "views/test-openapi-view/view.hpp"
#include "views/timetable/get/view.hpp"
#include "legacy/views/timetable/get/view.hpp"

void AppendPgControllers(userver::components::ComponentList& component_list)
{
using namespace components::controllers::postgres;
using namespace legacy::components::controllers::postgres;
user::Append(component_list);
token::Append(component_list);
lesson::Append(component_list);
Expand All @@ -47,6 +47,7 @@ void AppendPgControllers(userver::components::ComponentList& component_list)

void AppendViews(userver::components::ComponentList& component_list)
{
using namespace legacy::views;
using namespace views;
login::Append(component_list);
register_::Append(component_list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
#include <utils/postgres_helper.hpp>
#include <utils/shared_transaction.hpp>

#include "models/admin_account/postgre.hpp"
#include "models/admin_account/type.hpp"
#include "models/admin_filter/postgre.hpp"
#include "models/subgroup/serialize.hpp"
#include "models/user_credentials/postgre.hpp"
#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"

namespace components::controllers::postgres::admin
namespace legacy::components::controllers::postgres::admin
{
utils::SharedTransaction Controller::CreateTransaction() const
{
Expand All @@ -42,19 +42,19 @@ Controller::Controller(const userver::components::ComponentConfig& config,
{
}

std::optional<models::AdminAccount> Controller::GetAccountByAdminId(
std::optional<legacy::models::AdminAccount> Controller::GetAccountByAdminId(
const boost::uuids::uuid& admin_id,
::utils::SharedTransaction transaction) const
{
::utils::FillSharedTransaction(transaction, pg_cluster_);
auto pg_result = transaction->transaction_.Execute(
sql::qGetAdminAccountByAdminId, admin_id);
return utils::ConvertPgResultToOptionalItem<models::AdminAccount>(
return utils::ConvertPgResultToOptionalItem<legacy::models::AdminAccount>(
pg_result);
}

std::optional<models::AdminAccount> Controller::CreateAdmin(
const models::UserCredentials& user,
std::optional<legacy::models::AdminAccount> Controller::CreateAdmin(
const legacy::models::UserCredentials& user,
::utils::SharedTransaction transaction) const
{
::utils::FillSharedTransaction(transaction, pg_cluster_);
Expand All @@ -69,14 +69,14 @@ std::optional<models::AdminAccount> Controller::CreateAdmin(
return GetAccountByAdminId(admin_id, transaction);
}

std::vector<models::AdminAccount> Controller::GetByFilter(
std::optional<models::AdminFilter>& filter,
std::vector<legacy::models::AdminAccount> Controller::GetByFilter(
std::optional<legacy::models::AdminFilter>& filter,
::utils::SharedTransaction transaction) const
{
::utils::FillSharedTransaction(transaction, pg_cluster_);
auto pg_result =
utils::PgExecute(transaction, sql::qGetAdminsByFilter, filter);
return utils::ConvertPgResultToArray<models::AdminAccount>(pg_result);
return utils::ConvertPgResultToArray<legacy::models::AdminAccount>(pg_result);
}

} // namespace components::controllers::postgres::admin
} // namespace legacy::components::controllers::postgres::admin
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
#include <utils/shared_transaction.hpp>
#include <vector>

#include "models/admin_account/type.hpp"
#include "models/admin_filter/type.hpp"
#include "models/user_credentials/type.hpp"
#include "legacy/models/admin_account/type.hpp"
#include "legacy/models/admin_filter/type.hpp"
#include "legacy/models/user_credentials/type.hpp"

namespace components::controllers::postgres::admin
namespace legacy::components::controllers::postgres::admin
{
class Controller final : public userver::components::LoggableComponentBase
{
public:
using userver::components::LoggableComponentBase::LoggableComponentBase;
static constexpr inline std::string_view kName = "admin_controller";
std::optional<models::AdminAccount> GetAccountByAdminId(
std::optional<legacy::models::AdminAccount> GetAccountByAdminId(
const boost::uuids::uuid& admin_id,
utils::SharedTransaction transaction = nullptr) const;
std::optional<models::AdminAccount> CreateAdmin(
const models::UserCredentials& user,
std::optional<legacy::models::AdminAccount> CreateAdmin(
const legacy::models::UserCredentials& user,
utils::SharedTransaction transaction = nullptr) const;
Controller(const userver::components::ComponentConfig& config,
const userver::components::ComponentContext& context);
std::vector<models::AdminAccount> GetByFilter(
std::optional<models::AdminFilter>& filter,
std::vector<legacy::models::AdminAccount> GetByFilter(
std::optional<legacy::models::AdminFilter>& filter,
utils::SharedTransaction transaction = nullptr) const;
utils::SharedTransaction CreateTransaction() const;

protected:
userver::storages::postgres::ClusterPtr pg_cluster_;
};
} // namespace components::controllers::postgres::admin
} // namespace legacy::components::controllers::postgres::admin
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include "controller.hpp"

namespace components::controllers::postgres::lesson
namespace legacy::components::controllers::postgres::admin
{
void Append(userver::components::ComponentList& component_list)
{
component_list.Append<Controller>();
}
} // namespace components::controllers::postgres::lesson
} // namespace legacy::components::controllers::postgres::admin
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once
#include <utils/component_list_fwd.hpp>

namespace components::controllers::postgres::lesson
namespace legacy::components::controllers::postgres::admin
{
class Controller;
void Append(userver::components::ComponentList& component_list);
} // namespace components::controllers::postgres::lesson
} // namespace legacy::components::controllers::postgres::admin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <userver/storages/postgres/query.hpp>

namespace components::controllers::postgres::admin::sql
namespace legacy::components::controllers::postgres::admin::sql
{
const userver::storages::postgres::Query qCreateAdminAccount(R"(
WITH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
#include <utils/postgres_helper.hpp>
#include <utils/shared_transaction.hpp>

#include "models/admin_account/postgre.hpp"
#include "models/admin_filter/postgre.hpp"
#include "models/faculty/type.hpp"
#include "models/faculty_filter/postgre.hpp"
#include "models/request_privileges/type.hpp"
#include "models/subgroup/serialize.hpp"
#include "models/substring/postgre.hpp"
#include "models/user_credentials/postgre.hpp"
#include "legacy/models/admin_account/postgre.hpp"
#include "legacy/models/admin_filter/postgre.hpp"
#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"

namespace components::controllers::postgres::faculty
namespace legacy::components::controllers::postgres::faculty
{
::utils::SharedTransaction Controller::CreateTransaction()
{
Expand All @@ -47,15 +47,15 @@ Controller::Controller(const userver::components::ComponentConfig& config,
{
}

std::vector<models::Faculty> Controller::GetByFilter(
const std::optional<models::FacultyFilter>& filter,
std::vector<legacy::models::Faculty> Controller::GetByFilter(
const std::optional<legacy::models::FacultyFilter>& filter,
utils::SharedTransaction transaction) const
{
utils::FillSharedTransaction(transaction, pg_cluster_);
auto pg_result =
utils::PgExecute(transaction, sql::qGetFacultiesByFilter, filter);
return utils::ConvertPgResultToArray<models::Faculty>(pg_result);
return utils::ConvertPgResultToArray<legacy::models::Faculty>(pg_result);
}

} // namespace components::controllers::postgres::faculty
} // namespace legacy::components::controllers::postgres::faculty
// ::components::controllers::postgres::faculty
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <utils/shared_transaction.hpp>
#include <vector>

#include "models/faculty/type.hpp"
#include "models/faculty_filter/type.hpp"
#include "models/request_privileges/type.hpp"
#include "models/teacher/type.hpp"
#include "models/teacher_filter/type.hpp"
#include "models/teacher_info/type.hpp"
#include "legacy/models/faculty/type.hpp"
#include "legacy/models/faculty_filter/type.hpp"
#include "legacy/models/request_privileges/type.hpp"
#include "legacy/models/teacher/type.hpp"
#include "legacy/models/teacher_filter/type.hpp"
#include "legacy/models/teacher_info/type.hpp"

namespace components::controllers::postgres::faculty
namespace legacy::components::controllers::postgres::faculty
{
class Controller final : public userver::components::LoggableComponentBase
{
Expand All @@ -24,8 +24,8 @@ class Controller final : public userver::components::LoggableComponentBase
Controller(const userver::components::ComponentConfig& config,
const userver::components::ComponentContext& context);

std::vector<models::Faculty> GetByFilter(
const std::optional<models::FacultyFilter>& filter,
std::vector<legacy::models::Faculty> GetByFilter(
const std::optional<legacy::models::FacultyFilter>& filter,
utils::SharedTransaction transaction = nullptr) const;

public:
Expand All @@ -34,5 +34,5 @@ class Controller final : public userver::components::LoggableComponentBase
protected:
userver::storages::postgres::ClusterPtr pg_cluster_;
};
} // namespace components::controllers::postgres::faculty
} // namespace legacy::components::controllers::postgres::faculty
// ::components::controllers::postgres::faculty
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#include "controller.hpp"

namespace components::controllers::postgres::faculty
namespace legacy::components::controllers::postgres::faculty
{
void Append(userver::components::ComponentList& component_list)
{
component_list.Append<Controller>();
}
} // namespace components::controllers::postgres::faculty
} // namespace legacy::components::controllers::postgres::faculty
// ::components::controllers::postgres::faculty
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once
#include <utils/component_list_fwd.hpp>

namespace components::controllers::postgres::faculty
namespace legacy::components::controllers::postgres::faculty
{
class Controller;
void Append(userver::components::ComponentList& component_list);
} // namespace components::controllers::postgres::faculty
} // namespace legacy::components::controllers::postgres::faculty
// ::components::controllers::postgres::faculty
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include <userver/storages/postgres/query.hpp>

namespace components::controllers::postgres::faculty::sql
namespace legacy::components::controllers::postgres::faculty::sql
{
const userver::storages::postgres::Query qGetFacultiesByFilter(R"(
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
#include <utils/postgres_helper.hpp>
#include <utils/shared_transaction.hpp>

#include "models/admin_account/postgre.hpp"
#include "models/admin_filter/postgre.hpp"
#include "models/group_stage/type.hpp"
#include "models/group_stage_filter/postgre.hpp"
#include "models/request_privileges/type.hpp"
#include "models/subgroup/serialize.hpp"
#include "models/substring/postgre.hpp"
#include "models/user_credentials/postgre.hpp"
#include "legacy/models/admin_account/postgre.hpp"
#include "legacy/models/admin_filter/postgre.hpp"
#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"

namespace components::controllers::postgres::group_stage
namespace legacy::components::controllers::postgres::group_stage
{
::utils::SharedTransaction Controller::CreateTransaction()
{
Expand All @@ -47,15 +47,15 @@ Controller::Controller(const userver::components::ComponentConfig& config,
{
}

std::vector<models::GroupStage> Controller::GetByFilter(
const std::optional<models::GroupStageFilter>& filter,
std::vector<legacy::models::GroupStage> Controller::GetByFilter(
const std::optional<legacy::models::GroupStageFilter>& filter,
utils::SharedTransaction transaction) const
{
utils::FillSharedTransaction(transaction, pg_cluster_);
auto pg_result =
utils::PgExecute(transaction, sql::qGetGroupStages, filter);
return utils::ConvertPgResultToArray<models::GroupStage>(pg_result);
return utils::ConvertPgResultToArray<legacy::models::GroupStage>(pg_result);
}

} // namespace components::controllers::postgres::group_stage
} // namespace legacy::components::controllers::postgres::group_stage
// ::components::controllers::postgres::group_stage
Loading

0 comments on commit 6614d06

Please sign in to comment.