Merge pull request #1 from RaggedStaff/orders

Added OrderLines & bulk GET Orders
This commit is contained in:
Garethe
2024-05-03 14:54:06 +01:00
committed by GitHub
2 changed files with 214 additions and 11 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
# Spectral docs
*spectral*

222
dfc.yaml
View File

@@ -704,20 +704,15 @@ paths:
dfc-b:hasNutrientCharacteristic: []
dfc-b:hasAllergenCharacteristic: []
"/api/dfc/enterprises/{enterprise_id}/orders/{id}":
"/api/dfc/enterprises/{enterprise_id}/orders":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
get:
summary: Show Orders
summary: Show all Orders for an Enterprise
tags:
- Orders
responses:
@@ -756,7 +751,7 @@ paths:
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/enterprises/10000
dfc-b:hasPart:
- "@id": http://test.host/api/dfc/enterprises/{enterprise_id}/orderlines/10001-01
- "@id": http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/enterprises/10000/suppliedproducts/10001
dfc-b:hasQuantity:
@@ -769,9 +764,10 @@ paths:
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: []
dfc-b:hasPart: http://test.host/api/dfc/enterprises/{enterprise_id}/orderlines/10001-02
dfc-b:hasPart: http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-012
post:
Summary: Create an Order
parameters: []
tags:
- Orders
responses:
@@ -785,9 +781,135 @@ paths:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/{enterprise_id}/orderlines/10001-01
"@id": http://test.host/api/dfc/enterprises/10000/orders/10001
"@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/enterprises/10000/salessessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:hasOrderStatus: dfc-v:Draft
dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid
dfc-b:hasPaymentMethod:
"@type": dfc-b:PaymentMethod
dfc-b:paymentMethodType: Example Card PaymentMethod
dfc-b:paymentMethodProvider: Stripe
dfc-b:hasPrice:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: £0.27
dfc-b:VATrate: 0.00
dfc-b:discount: 1.55
dfc-b:OrderedBy: http://test.host/api/dfc/persons/10000
dfc-b:selects:
"@type": dfc-b:ShippingOption
dfc-b:optionOf: http://test.host/api/dfc/enterprises/10000/salessessions/10002
dfc-b:fee: 1.50
dfc-b:uses:
"@type": dfc-b:PickupOption
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/enterprises/10000
dfc-b:hasPart: http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
'404':
description: not found
"/api/dfc/enterprises/{enterprise_id}/orders/{id}":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
get:
summary: Show an Order
tags:
- Orders
responses:
'200':
description: success
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/orders/10001
"@type": dfc-b:Order
dfc-b:belongsTo: http://test.host/api/dfc/enterprises/10000/salessessions/10002
dfc-b:orderNumber: "MYORDERNUM:12345"
dfc-b:hasOrderStatus: dfc-v:Draft
dfc-b:hasFulfilmentStatus: dfc-v:Held
dfc-b:hasPaymentState: dfc-v:Unpaid
dfc-b:hasPaymentMethod:
"@type": dfc-b:PaymentMethod
dfc-b:paymentMethodType: Example Card PaymentMethod
dfc-b:paymentMethodProvider: Stripe
dfc-b:hasPrice:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: £0.27
dfc-b:VATrate: 0.00
dfc-b:discount: 1.55
dfc-b:OrderedBy: http://test.host/api/dfc/persons/10000
dfc-b:selects:
"@type": dfc-b:ShippingOption
dfc-b:optionOf: http://test.host/api/dfc/enterprises/10000/salessessions/10002
dfc-b:fee: 1.50
dfc-b:uses:
"@type": dfc-b:PickupOption
dfc-b:pickedUpAt: Our Fantastic Farm Gate
dfc-b:soldBy: http://test.host/api/dfc/enterprises/10000
dfc-b:hasPart:
- "@id": http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/enterprises/10000/suppliedproducts/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 5.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: []
dfc-b:hasPart: http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-012
'404':
description: not found
"/api/dfc/enterprises/{enterprise_id}/orders/{order_id}/orderlines":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: order_id
in: path
required: true
schema:
type: string
get:
summary: Show all Order Lines for an Order
tags:
- Orders
responses:
'200':
description: success
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/enterprises/10000/suppliedproducts/10001
dfc-b:partOf: http://test.host/api/dfc/enterprises/10000/orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
@@ -797,8 +919,86 @@ paths:
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: []
dfc-b:discount: 2.95
'404':
description: not found
post:
summary: Create Order Line
parameters: []
tags:
- Orders
responses:
'400':
description: bad request
'200':
description: success
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/enterprises/10000/suppliedproducts/10001
dfc-b:partOf: http://test.host/api/dfc/enterprises/10000/orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 5.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: 2.95
'404':
description: not found
"/api/dfc/enterprises/{enterprise_id}/orders/{order_id}/orderlines/{id}":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: order_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
get:
summary: Retrieve a single Order Line
tags:
- Orders
responses:
'200':
description: success
content:
application/json:
examples:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/enterprises/10000/orders/10001/orderlines/10001-01
"@type": dfc-b:OrderLine
dfc-b:concerns: http://test.host/api/dfc/enterprises/10000/suppliedproducts/10001
dfc-b:partOf: http://test.host/api/dfc/enterprises/10000/orders/10001
dfc-b:hasQuantity:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: Packet
dfc-b:hasValue: 5.0
dfc-b:Price:
"@type": dfc-b:QuantitativeValue
dfc-b:hasUnit: GBP
dfc-b:value: 19.95
dfc-b:VATrate: 0.0
dfc-b:discount: 2.95
'404':
description: not found