Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Create staff_tenant resource #443

Copy link
Copy link
@NickSchimek

Description

@NickSchimek
Issue body actions

Description
A bulk update on the staff_tenant_link table is required per the figma designs. See issue /issues/439 for more details.

Create a staff_tenant resource with the following url /staff-tenants that will accept a PATCH request with following payload structure:

{
staff: [<int:staff_id>, ...],
tenants: [<int:tenant_id>, ...]
}

The patch action will:

  • remove all rows in the staff_tenant_link table that exists for each given tenant id if any exist.
  • For each tenant id: Create a staff_tenant relationship for each provided staff id.

The above commands should all be performed within a single transaction (ex: call db.commit once) so that if there is an issue on commit it can be easily rolled back, and an appropriate error message sent to the frontend.

Possible validations to include:

  • Verify the provided staff id's are indeed Staff members.
  • Verify the provided tenant id's exist.

We probably wont be able to use any of the convenient methods defined in the BaseModel. May need to directly communicate with the db.session to add/remove objects from the session and the call db.session.commit() to commit all bulk changes in a single transaction.

See sqlalchemy docs:

Acceptance Criteria
Please list the requirements the implementation of this feature should meet.

  • Create schema and schema test file for validations
  • Create integration tests for new route
  • Create new route
  • Create patch action
  • Update README
  • Complete request in a single transaction

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.