-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Backend Rewrite #457
Draft
KavikaPalletenne
wants to merge
40
commits into
main
Choose a base branch
from
CHAOS-224-KHAOS-rewrite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
…AOS-224-KHAOS-rewrite
* start implementing authorisation * feat(backend): implement extractor for AuthUser (user id) * feat(backend): implement extractor for SuperUser (user id + authZ) --------- Co-authored-by: kappamalone <[email protected]>
KavikaPalletenne
changed the title
[WIP] Backend Rewrite
[WIP] feat(backend): Backend Rewrite
Feb 11, 2024
* start implementing authorisation * feat(backend): implement extractor for AuthUser (user id) * feat(backend): implement extractor for SuperUser (user id + authZ) * feat(backend): get existing or create new user for Google login * feat(backend): get name from Google user profile * feat(backend): update schema.prisma to include lowercase table names + updated_at default time for users --------- Co-authored-by: kappamalone <[email protected]>
* feat(ci): add postgres and migration to actions workflow * fix(ci): fix incorrect working directory
* feat(ci): add postgres and migration to actions workflow * fix(ci): fix incorrect working directory * fix(ci): ran cargo fmt and fix build errors
* feat(ci): add postgres and migration to actions workflow * fix(ci): fix incorrect working directory * fix(ci): ran cargo fmt and fix build errors * fix(ci): Incorrect working directory for cargo fmt * fix(ci): rust-cache keys
* feat(ci): add postgres and migration to actions workflow * fix(ci): fix incorrect working directory * fix(ci): ran cargo fmt and fix build errors * fix(ci): Incorrect working directory for cargo fmt * fix(ci): rust-cache keys * fix(ci): add workspaces to rust-cache
* feat(ci): add postgres and migration to actions workflow * fix(ci): fix incorrect working directory * fix(ci): ran cargo fmt and fix build errors * fix(ci): Incorrect working directory for cargo fmt * fix(ci): rust-cache keys * fix(ci): add workspaces to rust-cache * fix(ci): cargo fmt remove manifest-path arg
* fix(ci): run CI on rewrite branch pull request * feat(docs): added endpoint docs for org and users
* feat(docs): updates to user and organisation api spec * feat(docs): draft spec for campaign api * fix(ci): update rust workflow to use actions/cache
* feat(backend): create sql migrations * feat(backend): remove prisma schema * fix(ci): change from prisma migration to sql * fix(ci): no default sqlx-cli features * fix(backend): remove duplicate primary key for applications * fix(backend): rename migrations to prepend 'create' * fix(ci): check for cached sqlx before installing with cargo * fix(ci): remove ci run on specific paths
KavikaPalletenne
changed the title
[WIP] feat(backend): Backend Rewrite
[WIP] Backend Rewrite
Apr 7, 2024
* feat(db): add indexes for foreign key reference columns * fix(db): index naming and missing semicolons * dep(backend): update axum * fix(backend): remove testing jwt handlers * feat(backend): Add custom jwt validator and header * feat(backend): basic error handling enum * fix(backend): ran cargo fmt * fix(backend): remove unused imports
* feat(db): add indexes for foreign key reference columns * fix(db): index naming and missing semicolons * dep(backend): update axum * fix(backend): remove testing jwt handlers * feat(backend): Add custom jwt validator and header * feat(backend): basic error handling enum * fix(backend): ran cargo fmt * fix(backend): remove unused imports * Change to using `thiserror` * remove 'Error' from logic error names
* feat: Initial draft TODO: TESTING + more clarification * rearranged import * clear errors * post testing * feat(db): add indexes for foreign key reference columns * fix(db): index naming and missing semicolons * dep(backend): update axum * fix(backend): remove testing jwt handlers * feat(backend): Add custom jwt validator and header * feat(backend): basic error handling enum * fix(backend): ran cargo fmt * fix(backend): remove unused imports * CRUD operations - awaiting Campaign - haven't enforced db safety * implement feedback * Update rust.yml to include 224 branch * logic and style fixes * Change to using `thiserror` * add organisation_role type to db * update migration timestamps to be `NOT NULL` * change sqlx `time` to `chrono` * integrate organisations crud with error handling * return member role with org members * update sqlx type name for `UserRole` * simplify handlers to use new error type * removed unused imports * added `OrganisationAdmin` extractor * use `Transaction` when doing multiple queries * cargo fmt * add org route to app * move `Organisation` service functions into `Organisation` struct * moved org handlers into `OrganisationHandler` struct * ran cargo fmt * add S3 url generation to logo update * fixed error renaming * add routes to `main.rs` * cargo fmt --------- Co-authored-by: Alexander <[email protected]> Co-authored-by: Kavika <[email protected]>
* boilerplate for campaign * service layer for get, patch,put delete * handler updates * handler layer finalised * updated campaigns * fixed patch issue * remove empty `service/campaign.rs` file * add `organisation_name` to campaign details response * fix indentation of query code * change `cover_image` column type to UUID * minor changes * ran `cargo fmt` * remove unused `state` param * insert `organisation_id` when creating new campaign * change `organisations` logo column to `UUID` --------- Co-authored-by: Kavika <[email protected]>
* feat: added Role struct in model, implmented get and post for Role, updated api ymal for Role, added migration to change Role table in db * feat:added methods for delte and update role;added handler for role and added some routes into main regarding role * feat: added more api yaml documentation, added handler for create and get all roles in a campaign, added get all in roles in a campagin in model * fix: changed get_roles to Campaign Handler, changede migration file * change all id columns to `BIGINT` or `BIGSERIAL` * create `RoleAdmin` struct * move `create_role()` to `CampaignHandler` * cleanup * ran cargo fmt --------- Co-authored-by: Alex_Miao_WSL <[email protected]> Co-authored-by: Kavika <[email protected]>
* feat: added model file for application; added create method. fix: changed schema for application_role, fixed id type for role. * attempt to implement get for application; added additional fields for role response struct * added additional field to Application response type * feat: added get methods for application in model * fix pool usage in model/role, added set_status methods to application, patched API routes for get_all routes * added handlers for application; implemented Auth for ApplicationAdmin * added routes for applications in main; implement more handlers; moved some application handler methods to other more appropriate handlers * change `*Admin` `FromRequest` implementations to use HashMap of path variables * make 'Pending' the default Application status * return user info with `ApplicationDetails` --------- Co-authored-by: Alex_Miao_WSL <[email protected]> Co-authored-by: Kavika <[email protected]>
* added get_username for all users logged in * updted user crud * efficient user get fucntion * finished user but no testing * finished user crud * docker working file * set users `created_at` and `updated_at` to not null * set optional fields to `Option` in `User` struct * fix `query_as` with custom enums * finished user crud * changed User CRUD to use handler struct * move `User` DB logic to `models::User` file * add pronouns and gender to `User` * remove TODO comment * fixed errors and warnings with adding new user fields --------- Co-authored-by: Alex_Miao_WSL <[email protected]> Co-authored-by: Kavika <[email protected]>
…483) * Move initial migration to one file * Update initial schema NOT NULL columns * Fix question_id ref column being int not bigint * Question framework and impl for MultiOption and ShortAnswer * answer framework for short answer and multichoice * update `Question` documentation to fit `serde` representation * fix duplicates in question framework * remove redundancy in answer framework * make question option id unique snowflake * re-separate schema migrations * set timestamps fields to `NOT NULL` * add answer to models module file * fix enum errors * fix always true/false case in answer length * add `Ranking` question type * rename multi option data "rank" to "order" * update question json example * fix use of postgres keyword `order` --------- Co-authored-by: skye_blair <[email protected]>
* feat(backend): ratings CRUD draft * backend: added auth to ratings CRUD * implemented most feedback * fixed ratings authorisation * fixed create rating authorisation * Update .gitignore * add optional `comment` to rating * removed redundant authorisation service * renamed RatingCreatorAdmin * remove "Admin" from some AuthZ models * fix merge error * use `ChaosError` for Question and Answer functions * Update Cargo.toml * Revert "Update Cargo.toml" This reverts commit 9a8c7b7. --------- Co-authored-by: Kavika <[email protected]>
* initially defer foreign key updates on questions and options * add multi_choice_options unique constraint to (question_id, display_order) * fix warnings * `Question` model implementation * rename "ratings" to "rating" * rename `RatingHandler::create_rating()` * remove whitespace on indexes in migrations * add roles support for questions * Question CRUD * fix `id` to `role_id` in filtering by campaign and role * fix forgotten transaction commits * Answer CRUD * ran cargo format * use `fetch_one()` to check valid id * fix path not stating with `/` * add `cargo run` to CI/CD for rust * remove `cargo run` from rust pipeline * remove todo clarifying authZ Co-authored-by: Alex Miao <[email protected]> * fix rater_id passed in json * commit Organisation member transactions * move `Router` creation to `models/app.rs` * change `QuestionType` `if`/`else` to `match` statement --------- Co-authored-by: Alex Miao <[email protected]>
* feat(docs): updates to user and organisation api spec * feat(docs): draft spec for campaign api * fix(ci): update rust workflow to use actions/cache * rewrite API yamal file using components/schema up to /api/v1/role/:role_id * rewrite API yamal file using components/schema up to /api/v1/role/:role_id I guess * rewrite API yamal file using components/schema up to /api/v1/role/:role_id I guess * finished API doc * Update rust.yml --------- Co-authored-by: Kavika <[email protected]> Co-authored-by: Alex_Miao_WSL <[email protected]>
* change all db pool in `Campaign` to transactions * move extracting user_id from request to helper function * add slugs to `Campaign` and `Organisation` * add endpoints to check slug availability * slug utility functions and checks * email templating and offer CRUD * fix email_template auth service join * offer CRUD * ran `cargo fmt` & remove unused imports
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Completely rewritten backend: