Skip to content

Commit

Permalink
Merge pull request #5 from Adventure-Tech/feature/new-amounts-object
Browse files Browse the repository at this point in the history
Feature/new amounts object
  • Loading branch information
docdauck authored Nov 23, 2023
2 parents ef7b834 + b5ebb21 commit e198f53
Show file tree
Hide file tree
Showing 47 changed files with 876 additions and 483 deletions.
736 changes: 430 additions & 306 deletions dist/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
get:
description: Returns a single product based on its ID
description: Returns paginated list of availabilities
tags: [ Availabilities API ]
parameters:
- name: from
Expand All @@ -26,7 +26,7 @@ get:
type: integer
responses:
200:
description: Successfully retrieved the product from the server
description: Successfully retrieved the availabilities from the server
content:
application/json:
schema:
Expand All @@ -35,4 +35,21 @@ get:
data:
type: array
items:
$ref: '../../schemas/availabilities/Availability.yaml'
$ref: '../../schemas/availabilities/Availability.yaml'
links:
$ref: '../../schemas/pagination/Links.yaml'
post:
description: Creates new availability
tags: [ Availabilities API ]
requestBody:
content:
application/json:
schema:
$ref: '../../schemas/availabilities/Availability.yaml'
responses:
201:
description: Successfully created new availability on the server
content:
application/json:
schema:
$ref: '../../schemas/availabilities/AvailabilityWrapped.yaml'
41 changes: 41 additions & 0 deletions endpoints/availability/Availability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
get:
description: Returns a single availability based on its ID
tags: [ Availabilities API ]
parameters:
- $ref: '../../parameters/path/AvailabilityId.yaml'
responses:
200:
description: Successfully retrieved the availability from the server
content:
application/json:
schema:
$ref: '../../schemas/availabilities/AvailabilityWrapped.yaml'
404:
$ref: '../../responses/404NotFound.yaml'
patch:
description: Patch a specific availability based on its ID. This is inspired by the JSON patch syntax with some modifications such as custom operations and modified array referencing
tags: [ Availabilities API ]
parameters:
- $ref: '../../parameters/path/AvailabilityId.yaml'
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '../../schemas/jsonpatch/PatchObject.yaml'
responses:
200:
description: Successfully updated the availability on the server
content:
application/json:
schema:
$ref: '../../schemas/availabilities/AvailabilityWrapped.yaml'
delete:
description: Delete a specific availability based on its ID
tags: [ Availabilities API ]
parameters:
- $ref: '../../parameters/path/AvailabilityID.yaml'
responses:
200:
description: Successfully deleted the availability on the server
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ get:
content:
application/json:
schema:
$ref: '../../schemas/products/ProductWrapped.yaml'
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/products/Product.yaml'
404:
$ref: '../../responses/404NotFound.yaml'
patch:
Expand All @@ -30,12 +34,16 @@ patch:
content:
application/json:
schema:
$ref: '../../schemas/products/ProductWrapped.yaml'
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/products/Product.yaml'
delete:
description: Cancel a specific product based on its ID
description: Soft-delete a specific product based on its ID
tags: [ Products API ]
parameters:
- $ref: '../../parameters/path/ProductId.yaml'
responses:
200:
description: Successfully cancelled the product on the server
description: Successfully soft-deleted the product on the server
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ post:
content:
application/json:
schema:
$ref: '../../schemas/products/ProductWrapped.yaml'
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/products/Product.yaml'
File renamed without changes.
49 changes: 49 additions & 0 deletions endpoints/vat/VatEndpoints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
get:
description: Returns a single vat model based on its ID
tags: [ VAT API ]
parameters:
- $ref: '../../parameters/path/VatModelId.yaml'
responses:
200:
description: Successfully retrieved the vat model from the server
content:
application/json:
schema:
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/vat/VatModel.yaml'
404:
$ref: '../../responses/404NotFound.yaml'
patch:
description: Patch a specific vat model based on its ID. This is inspired by the JSON patch syntax with some modifications such as custom operations and modified array referencing
tags: [ VAT API ]
parameters:
- $ref: '../../parameters/path/VatModelId.yaml'
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '../../schemas/jsonpatch/PatchObject.yaml'
responses:
200:
description: Successfully updated the vat model on the server
content:
application/json:
schema:
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/vat/VatModel.yaml'
delete:
description: Soft-delete a specific vat model based on its ID
tags: [ VAT API ]
parameters:
- $ref: '../../parameters/path/VatModelId.yaml'
responses:
200:
description: Successfully deleted the vat model on the server
39 changes: 39 additions & 0 deletions endpoints/vat/VatsEndpoints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
get:
description: Returns paginated list of vat models
tags: [ VAT API ]
parameters:
- $ref: '../../parameters/query/PageCursor.yaml'
- $ref: '../../parameters/query/PerPage.yaml'
responses:
200:
description: Successfully retrieved vat models from the server
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '../../schemas/vat/VatModel.yaml'
links:
$ref: '../../schemas/pagination/Links.yaml'
post:
description: Creates new vat model
tags: [ VAT API ]
requestBody:
content:
application/json:
schema:
$ref: '../../schemas/vat/VatModel.yaml'
responses:
201:
description: Successfully created new vat model on the server
content:
application/json:
schema:
type: object
required: [ data ]
properties:
data:
$ref: '../../schemas/vat/VatModel.yaml'
25 changes: 14 additions & 11 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,33 @@ info:

servers:
- url: 'https://bilberry.test/api/v0'
- url: 'https://bilberry-v3-staging-sxren.ondigitalocean.app/api/v0'

#security:
# - BasicAuth: []

paths:
/products:
$ref: './api/products/Products.yaml'
$ref: './endpoints/products/ProductsEndpoints.yaml'
/product/{product}:
$ref: './api/products/Product.yaml'
/availabilities:
$ref: './api/availability/Availabilities.yaml'
$ref: './endpoints/products/ProductEndpoints.yaml'
# /availabilities:
# $ref: './endpoints/availability/Availabilities.yaml'
# /availabilities/{availability}:
# $ref: './endpoints/availability/Availability.yaml'
/bookings:
$ref: './api/bookings/Bookings.yaml'
$ref: './endpoints/bookings/BookingsEndpoints.yaml'
/bookings/{booking}:
$ref: './api/bookings/Booking.yaml'
$ref: './endpoints/bookings/BookingEndpoints.yaml'
/invoices/{invoice}:
$ref: './api/reporting/Invoice.yaml'
$ref: './endpoints/reporting/InvoiceEndpoints.yaml'
/notifications:
$ref: './api/notifications/Notifications.yaml'
$ref: './endpoints/notifications/NotificationsEndpoints.yaml'

/users: {}
/instances: {}
/resources: {}
/vat-models: {}
/vat-models:
$ref: './endpoints/vat/VatsEndpoints.yaml'
/vat-models/{vat}:
$ref: './endpoints/vat/VatEndpoints.yaml'
/reports: {}
/staff: {}
7 changes: 7 additions & 0 deletions parameters/path/AvailabilityId.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: availability
in: path
required: true
description: The availability ID
schema:
type: integer
minimum: 0
7 changes: 7 additions & 0 deletions parameters/path/VatModelId.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: vat
in: path
required: true
description: The vat model ID
schema:
type: integer
minimum: 0
21 changes: 13 additions & 8 deletions schemas/availabilities/Availability.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
type: object
required:
- productId
- ticketOptionId
- bookableId
- availability
required: [productId, ticketOptionId, productId, availability, price, maxCapacity]
properties:
productId:
type: integer
id:
$ref: '../types/ID.yaml'
createdAt:
$ref: '../types/CreatedAt.yaml'
ticketOptionId:
type: integer
bookableId:
productId:
type: integer
readOnly: true
availability:
type: integer
readOnly: true
minimum: 0
start:
type: string
format: date-time
end:
type: string
format: date-time
price:
$ref: '../prices/Price.yaml'
maxCapacity:
type: integer
minimum: 0
# cutoff, refund policy, price,
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ type: object
required: [data]
properties:
data:
$ref: './Product.yaml'
$ref: './Availability.yaml'
13 changes: 1 addition & 12 deletions schemas/bookings/Booking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,7 @@ allOf:
tickets:
type: array
items:
type: object
required: [ id, bookableId, quantity ]
properties:
id:
$ref: '../types/ULID.yaml'
bookableId:
type: integer
quantity:
type: integer
minimum: 1
default: 1
# TODO: more info about product, ticket option etc?
$ref: './Ticket.yaml'
invoice:
allOf:
- $ref: '../reporting/InvoiceShort.yaml'
Expand Down
36 changes: 19 additions & 17 deletions schemas/bookings/BookingMetaInfo.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
type: object
required: [firstName, lastName, email, phone]
properties:
firstName:
type: string
nullable: true
lastName:
type: string
nullable: true
email:
type: string
format: email
nullable: true
phone:
allOf:
- $ref: '../types/PhoneNumber.yaml'
- nullable: true
allOf:
- type: object
required: [firstName, lastName, email, phone]
properties:
firstName:
type: string
nullable: true
lastName:
type: string
nullable: true
email:
type: string
format: email
nullable: true
phone:
allOf:
- $ref: '../types/PhoneNumber.yaml'
- nullable: true
- $ref: '../types/Address.yaml' # TODO: nullability
Loading

0 comments on commit e198f53

Please sign in to comment.