Skip to content

Latest commit

 

History

History
182 lines (146 loc) · 3.62 KB

api.rest

File metadata and controls

182 lines (146 loc) · 3.62 KB

@host = https://127.0.0.1:8000 # @host = https://ssd.pingflood.tk @superuser_username = {{$dotenv SUPERUSER_USERNAME}} @superuser_password = {{$dotenv SUPERUSER_PASSWORD}} @staff_username = {{$dotenv STAFF_USERNAME}} @staff_password = {{$dotenv STAFF_PASSWORD}} @user_username = {{$dotenv USER_USERNAME}} @user_password = {{$dotenv USER_PASSWORD}} @user2_username = {{$dotenv USER2_USERNAME}} @user2_password = {{$dotenv USER2_PASSWORD}}

@authToken = {{login.response.body.access}}

### # @name login POST {{host}}/api/v1/login/ Content-Type: application/json

{
"username": "{{superuser_username}}", "password": "{{superuser_password}}"

}

### # @name login POST {{host}}/api/v1/login/ Content-Type: application/json

{
"username": "{{staff_username}}", "password": "{{staff_password}}"

}

### # @name login POST {{host}}/api/v1/login/ Content-Type: application/json

{
"username": "{{user_username}}", "password": "{{user_password}}"

}

### # @name login POST {{host}}/api/v1/login/ Content-Type: application/json

{
"username": "{{user2_username}}", "password": "{{user2_password}}"

}

#### DRESS ######

### GET {{host}}/api/v1/dress/ Authorization: Bearer {{authToken}}

### GET {{host}}/api/v1/dress/40506fda-ad31-4434-a534-b0ecf7198b18 Authorization: Bearer {{authToken}}

### POST {{host}}/api/v1/dress/2023-12-07

"priceInCents": 9000, "materialType": "COTTON", "colorType": "RED", "size": 44, "description": "Fantastico", "deleted": true

}

### PUT {{host}}/api/v1/dress/018ce62f-0b09-4b0c-a414-d897600dac55 Content-Type: application/json Authorization: Bearer {{authToken}}

{
"id": "018ce62f-0b09-4b0c-a414-d897600dac55", "brandType": "VALENTINO", "priceInCents": 9000, "materialType": "COTTON", "colorType": "RED", "size": 44, "description": "Fantastico", "deleted": false

}

### DELETE {{host}}/api/v1/dress/40506fda-ad31-4434-a534-b0ecf7198b18 Authorization: Bearer {{authToken}}

#### DRESS LOAN ######

### GET {{host}}/api/v1/loan Authorization: Bearer {{authToken}}

### GET {{host}}/api/v1/loan/a131df8a-7511-4640-b085-357cac1e6e34 Authorization: Bearer {{authToken}}

### POST {{host}}/api/v1/loan/ Content-Type: application/json Authorization: Bearer {{authToken}}

{
"startDate": "2022-12-29", "endDate": "2023-01-01", "dress": "f63c5997-3f96-4ddf-a72f-19f91c96ab43", "loaner": 3

}

### PUT {{host}}/api/v1/loan/17af64be-e95f-4501-8581-c2037889e938 Authorization: Bearer {{authToken}} Content-Type: application/json

{
"id": "28acfa16-ecf2-47c8-bb54-12f8738bedf1", "startDate": "2022-12-01", "endDate": "2023-01-03", "dress": "f63c5997-3f96-4ddf-a72f-19f91c96ab43", "loaner": 3, "totalPrice": 3060, "loanDurationDays": 34, "insertBy": 3, "terminated": false

}

### DELETE {{host}}/api/v1/loan/bf17aea8-2b1d-4b5b-a4c0-5aad167671cc Authorization: Bearer {{authToken}}

#### USER ######

### GET {{host}}/api/v1/user Authorization: Bearer {{authToken}}

### GET {{host}}/api/v1/user/3 Authorization: Bearer {{authToken}}

### POST {{host}}/api/v1/user/ Content-Type: application/json Authorization: Bearer {{authToken}}

{
"dress": "51cc5d6f-38be-420e-bd75-2b2359d3badf", "startDate": "2022-11-26", "endDate": "2022-12-12", "loaner": 2, "insertBy": 3

}

### PUT {{host}}/api/v1/user/1 Authorization: Bearer {{authToken}} Content-Type: application/json

{
"id": "b3819e83-1863-49a2-8871-02acb2eae79d", "dress": "28bce53b-6c7e-478b-ab85-a5f2066a5278", "startDate": "2022-11-26", "endDate": "2022-12-12", "loaner": 2, "insertBy": 1

}

### DELETE {{host}}/api/v1/user/4 Authorization: Bearer {{authToken}}

a.keys() res.json()[list(res.json().keys())[0]]