Added Create, Update & Delete for Enterprise

This commit is contained in:
RaggedStaff
2024-05-14 07:47:24 +01:00
parent 48292ac2fa
commit 0ddb2a1e23

236
dfc.yaml
View File

@@ -14,7 +14,6 @@ info:
This API implements the Data Food Consortium (DFC) specifications.
It serves and reads semantic data encoded in JSON-LD.
<p>
Unfortunately, this description does not appear in the Swagger UI. :-(
components:
securitySchemes:
oidc_token:
@@ -213,14 +212,15 @@ paths:
dfc-b:stockLimitation: '3'
dfc-b:sku: new-sku
"/api/dfc/Enterprises/{enterprise_id}/customerCategories":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
get:
summary: Return a list of Customer Categories for an Enterprise
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
parameters: []
tags:
- CustomerCategory
responses:
@@ -240,12 +240,9 @@ paths:
dfc-b:definedBy: http://test.host/api/dfc/Enterprises/10000
post:
summary: create a new Customer Category for a given Enterprise
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
parameters: []
tags:
- CustomerCategory
responses:
'201':
description: created
@@ -261,19 +258,20 @@ paths:
"@id": http://test.host/api/dfc/Enterprises/10000/customerCategories/10006
"/api/dfc/Enterprises/{enterprise_id}/customerCategories/{id}":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
get:
summary: Return a specific Customer Category for an Enterprise
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
parameters: []
tags:
- CustomerCategory
responses:
@@ -291,17 +289,9 @@ paths:
dfc-b:definedBy: http://test.host/api/dfc/Enterprises/10000
delete:
summary: remove a Customer Category for a given Enterprise
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
parameters: []
tags:
- CustomerCategory
responses:
'204':
description: no content
@@ -356,14 +346,15 @@ paths:
description: unauthorized
"/api/dfc/Enterprises/{id}":
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
summary: Show enterprise
parameters:
- name: id
in: path
required: true
schema:
type: string
parameters: []
tags:
- Enterprises
responses:
@@ -379,9 +370,9 @@ paths:
- "@id": http://test.host/api/dfc/Enterprises/10000
"@type": dfc-b:Enterprise
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000
dfc-b:hasPhoneNumber: 0404 444 000 200
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200
dfc-b:email: hello@example.org
dfc-b:websitePage: openfoodnetwork.org
dfc-b:websitePage: https://test.host/
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
dfc-b:name: Fred's Farm
dfc-b:hasDescription: This is an awesome enterprise
@@ -424,6 +415,129 @@ paths:
dfc-b:URL: https://facebook.com/user
'404':
description: not found
'post':
summary: Create an Enterprise
tags:
- Enterprises
responses:
'201':
description: created
'400':
description: bad request
'401':
description: unauthorized
requestBody:
content:
application/json:
schema:
example:
test_example:
value:
"@context": https://www.datafoodconsortium.org
"@type": dfc-b:Enterprise
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000200
dfc-b:email: hello@example.org
dfc-b:websitePage: https://test.host/
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
dfc-b:name: Fred's Farm
dfc-b:hasDescription: This is an awesome enterprise
dfc-b:VATnumber: 123 456
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000
dfc-b:logo: http://test.host/active-storage/url/logo.png
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000
'put':
summary: Update an Enterprise
parameters: []
tags:
- Enterprises
responses:
'204':
description: no content
requestBody:
content:
application/json:
schema:
example:
"@context": https://www.datafoodconsortium.org
"@id": http://test.host/api/dfc/Enterprises/10000
"@type": dfc-b:Enterprise
dfc-b:hasAddress: http://test.host/api/dfc/Addresses/40000
dfc-b:hasPhoneNumber: http://test.host/api/dfc/PhoneNumbers/444000245
dfc-b:email: support@example.org
dfc-b:websitePage: https://www.test.host
dfc-b:hasSocialMedia: http://test.host/api/dfc/Enterprises/10000/SocialMedias/facebook
dfc-b:name: Fred's New & Improved Farm
dfc-b:hasDescription: This is now an even more awesome enterprise
dfc-b:VATnumber: 123 456
dfc-b:manages: http://test.host/api/dfc/Enterprises/10000/CatalogItems/10001
dfc-b:supplies: http://test.host/api/dfc/Enterprises/10000/SuppliedProducts/10001
dfc-b:hasMainContact: http://test.host/api/dfc/Persons/10000
dfc-b:logo: http://test.host/active-storage/url/logo.png
dfc-b:affiliates: http://test.host/api/dfc/Enterprises/60000
delete:
summary: remove an Enterprise
parameters: []
tags:
- Enterprises
responses:
'204':
description: no content
'401':
description: unauthorized
"/api/dfc/Enterprises/{enterprise_id}/affiliatedTo":
post:
summary: Affilate 2 Enterprises (1 in path, 1 in requestBody)
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
tags:
- Enterprises::affiliatedTo
responses:
'201':
description: created
'400':
description: bad request
'401':
description: unauthorized
requestBody:
content:
application/json:
schema:
example:
"@id": http://test.host/api/dfc/Enterprises/10001
"/api/dfc/Enterprises/{enterprise_id}/affiliatedTo/{id}":
delete:
summary: Remove an Enterprise affiliatedTo link
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
tags:
- Enterprises::affiliatedTo
responses:
'204':
description: no content
'401':
description: unauthorized
"/api/dfc/Enterprises/{enterprise_id}/Offers/{id}":
parameters:
- name: enterprise_id
@@ -477,14 +591,15 @@ paths:
dfc-b:offersTo: https://test.host/api/dfc/enterprises/10000/customerCategories/10005
"/api/dfc/persons/{id}":
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
summary: Show person
parameters:
- name: id
in: path
required: true
schema:
type: string
parameters: []
tags:
- Persons
responses:
@@ -501,19 +616,20 @@ paths:
'404':
description: not found
"/api/dfc/Enterprises/{enterprise_id}/SocialMedias/{name}":
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: name
in: path
required: true
schema:
type: string
get:
summary: Show social media
parameters:
- name: enterprise_id
in: path
required: true
schema:
type: string
- name: name
in: path
required: true
schema:
type: string
parameters: []
tags:
- SocialMedias
responses: