Acits Backend Test Task.
Stepan TymetskiyYou must to develop rest api web service. DB scheme is here.
Common requirements:
- Authentication: JWT.
- Good readme file or you may implement swager for autogenerated documentation for all API points.
- Main (50%) API points must be cover by unit tests (or better say integration tests). If you could cover all API points it would be plus, but is not required.
- Basic admin implementation (without any customization or smth.)
Stack: Django (last version), DRF, unitests (because project already used unitests).
API points:
- some points for getting token
- api/v1/register/ -POST
Description: user creation.
Permission: available to everyone. - api/v1/users/ - GET & api/v1/users/<pk>/ - GET
Description: user list, user detail.
Permission: API point available only for registered user. OWNER may see users only with status RENTER. RENTER may see users only with status OWNER.
Fields: All basic fields (don't forget "age").
Filter: by lang (choice), by age.
Ordering: first_name, last_name.
Search: email, phone, first_name, last_name. - api/v1/flats/ - GET, POST, PUT, DELETE
Description: flat list, flat detail.
Permission: API point available only for registered users. Only OWNER can create flat also OWNER can delete or edit only his flats.
Fields: All flat fields (don't forget room_count) including build object (id, name, address) also must be flat_rooms object (id, type, description, created_at, updated_at) and flat_attributes (attribute_id, name, count, description) inside flat_rooms.
Filter: by build_id, by type (multiple choice), by price (gte, lt), created_at (range: from - to).
Ordering: build_id, room_count, owner_id.
Search: price (range from - to).
JSON Example:
{
"id": 1,
"another_flat_fields": "smth",
"build": {
"id": 1,
"another_build_fields": "smth",
},
"flat_rooms": [
{
"id": 1,
"another_flat_fields": "smth",
"flat_attributes": [
{
"id": 1,
"name": "name"
},
{
"id": 1,
"name": "name"
}
]
}
]
}
Validation:
1) At least one room at the flat.
2) At least two attributes in room.
3) count field in flat_attributes > 0 - api/v1/flats/<pk>/rooms/ & api/v1/flats/<pk>/rooms/<pk>/
Description: room list, room detail - GET
Permission: API point available only for registered users.
Fields: id, name, description, attributes object (name, count, description, created_at).
Ordering: build_id, room_count, owner_id. - api/v1/order/ & api/v1/order/<pk>/ GET, POST, PUT, DELETE
Description: order list, order detail - GET, POST, PUT, DELETE
Permission: API point available only for registered users. User can watch only their personal orders. All user can create order, but edit or delete can only owner of this order.
Fields: all (included total_price).
Ordering: total_price.