-
Notifications
You must be signed in to change notification settings - Fork 1
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
f4a3ce1
commit 5eb2327
Showing
22 changed files
with
59 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,12 @@ jobs: | |
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: init submdule userver | ||
run: | | ||
sudo git submodule update --init --recursive | ||
- name: add Postgres package repository | ||
run: | | ||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | ||
|
@@ -85,19 +88,19 @@ jobs: | |
- name: Configure cmake project | ||
run: > | ||
cmake | ||
-B _cmake_build_{{matrix.compiler}}_{{matrix.version}}_{{matrix.type}} | ||
-DCMAKE_BUILD_TYPE={{matrix.type}} | ||
-B cmake_build_main | ||
-G Ninja | ||
-DCMAKE_BUILD_TYPE=${{matrix.type}} | ||
-DCMAKE_C_COMPILER=$(make find-c-compiler compiler=${{matrix.compiler}} version=${{matrix.version}}) | ||
-DCMAKE_CXX_COMPILER=$(make find-cxx-compiler compiler=${{matrix.compiler}} version=${{matrix.version}}) | ||
- name: Build project | ||
run: > | ||
cmake | ||
--build _cmake_build_{{matrix.compiler}}_{{matrix.version}}_{{matrix.type}} | ||
-j 6 | ||
--build cmake_build_main | ||
--target all | ||
- name: Run ${{matrix.make}} | ||
- name: Run tests | ||
run: | | ||
cd _cmake_build_{{matrix.compiler}}_{{matrix.version}}_{{matrix.type}} | ||
cd cmake_build_main | ||
(test -t 1 && GTEST_COLOR=1 PYTEST_ADDOPTS="--color=yes" ctest -V) || ctest -V |
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,2 +1,3 @@ | ||
/*cmake*/ | ||
/src/codegen/* | ||
/src/codegen/* | ||
*__pycache__* |
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 |
---|---|---|
|
@@ -30,4 +30,4 @@ namespace helpers{ | |
end_ts); | ||
return result.AsOptionalSingleRow<boost::uuids::uuid>(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ namespace models::auth{ | |
struct Response{ | ||
ResponseBody body; | ||
}; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ namespace models{ | |
struct ErrorResponse{ | ||
ErrorResponseBody body; | ||
}; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -19,4 +19,4 @@ SELECT token_id | |
FROM live_token | ||
UNION ALL | ||
SELECT token_id | ||
FROM new_token; | ||
FROM new_token; |
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,7 +1,29 @@ | ||
#include "handler.hpp" | ||
|
||
#include <helpers/auth.hpp> | ||
|
||
namespace views::login{ | ||
void Append(userver::components::ComponentList& componentList){ | ||
componentList.Append<handler>(); | ||
} | ||
} | ||
|
||
handler::response handler::handle(views::login::Request req) const { | ||
userver::storages::postgres::TimePointTz now(userver::utils::datetime::Now()); | ||
userver::storages::postgres::TimePointTz end_ts(userver::utils::datetime::Now() + std::chrono::hours(1)); | ||
auto token = helpers::GetToken( | ||
todo_db, | ||
req.body.login, | ||
req.body.password, | ||
now, | ||
end_ts); | ||
if (!token){ | ||
Response400 resp400; | ||
resp400().body.message = "Invalid login or password"; | ||
resp400().body.error_code = models::ErrorCode::invalid_credentials; | ||
return resp400; | ||
} | ||
Response200 response200; | ||
response200().body.token = *token; | ||
return response200; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
namespace views::login{ | ||
struct handler; | ||
void Append(userver::components::ComponentList& componentList); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -38,4 +38,4 @@ namespace views::Register{ | |
private: | ||
userver::storages::postgres::ClusterPtr todo_db; | ||
}; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
namespace views::Register{ | ||
struct handler; | ||
void Append(userver::components::ComponentList& componentList); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
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