From db6bcd014df5afd8d9c58d0735862b3adfcf1c08 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Wed, 29 Jan 2020 16:07:23 +0100 Subject: [PATCH 1/2] Adding audience property --- api/public/schema/openapi.yaml | 129 +++++++++++++++++++++++------- api/public/schema/publiccode.yaml | 2 +- api/src/Entity/Product.php | 21 +++++ 3 files changed, 123 insertions(+), 29 deletions(-) diff --git a/api/public/schema/openapi.yaml b/api/public/schema/openapi.yaml index 35719e65..874b91ab 100644 --- a/api/public/schema/openapi.yaml +++ b/api/public/schema/openapi.yaml @@ -2416,13 +2416,31 @@ paths: $ref: '#/components/schemas/Product-read' parameters: - - name: sku + name: 'order[type]' in: query required: false schema: type: string + enum: + - asc + - desc - - name: 'sku[]' + name: 'order[sku]' + in: query + required: false + schema: + type: string + enum: + - asc + - desc + - + name: groups.id + in: query + required: false + schema: + type: string + - + name: 'groups.id[]' in: query required: false schema: @@ -2432,13 +2450,13 @@ paths: style: form explode: true - - name: sourceOrganization + name: type in: query required: false schema: type: string - - name: 'sourceOrganization[]' + name: 'type[]' in: query required: false schema: @@ -2448,13 +2466,13 @@ paths: style: form explode: true - - name: type + name: sku in: query required: false schema: type: string - - name: 'type[]' + name: 'sku[]' in: query required: false schema: @@ -2464,14 +2482,17 @@ paths: style: form explode: true - - name: 'order[type]' + name: name + in: query + required: false + schema: + type: string + - + name: description in: query required: false schema: type: string - enum: - - asc - - desc - name: page in: query @@ -4390,6 +4411,9 @@ components: externalDocs: url: 'http://schema.org/identifier' type: string + icon: + description: 'The icon of this property' + type: string name: description: 'The name of this product group' type: string @@ -4420,10 +4444,10 @@ components: Group-write: type: object description: 'An entity representing a product group.' - required: - - name - - sourceOrganization properties: + icon: + description: 'The icon of this property' + type: string name: description: 'The name of this product group' type: string @@ -4438,6 +4462,9 @@ components: catalogue: description: 'The Catalogue that this product group belongs to' $ref: '#/components/schemas/Catalogue-write' + required: + - name + - sourceOrganization 'Group:jsonld-read': type: object description: 'An entity representing a product group.' @@ -4457,6 +4484,9 @@ components: externalDocs: url: 'http://schema.org/identifier' type: string + icon: + description: 'The icon of this property' + type: string name: description: 'The name of this product group' type: string @@ -4487,9 +4517,6 @@ components: 'Group:jsonld-write': type: object description: 'An entity representing a product group.' - required: - - name - - sourceOrganization properties: '@context': readOnly: true @@ -4500,6 +4527,9 @@ components: '@type': readOnly: true type: string + icon: + description: 'The icon of this property' + type: string name: description: 'The name of this product group' type: string @@ -4514,6 +4544,9 @@ components: catalogue: description: 'The Catalogue that this product group belongs to' $ref: '#/components/schemas/Catalogue:jsonld-write' + required: + - name + - sourceOrganization Offer-read: type: object description: 'An entity representing an offer.' @@ -4536,11 +4569,13 @@ components: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR externalDocs: url: 'http://schema.org/priceCurrency' @@ -4602,11 +4637,13 @@ components: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR externalDocs: url: 'http://schema.org/priceCurrency' @@ -4669,11 +4706,13 @@ components: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR externalDocs: url: 'http://schema.org/priceCurrency' @@ -4744,11 +4783,13 @@ components: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR externalDocs: url: 'http://schema.org/priceCurrency' @@ -4877,6 +4918,9 @@ components: type: array items: type: string + audience: + description: 'The audience this product is intended for' + type: string required: - name - sourceOrganization @@ -4956,6 +5000,9 @@ components: requiresAppointment: description: 'If the product requires a physical appointment, for example to request travel documents or for the booking of hotel rooms' type: boolean + audience: + description: 'The audience this product is intended for' + type: string required: - name - sourceOrganization @@ -5070,6 +5117,9 @@ components: type: array items: type: string + audience: + description: 'The audience this product is intended for' + type: string required: - name - sourceOrganization @@ -5158,6 +5208,9 @@ components: requiresAppointment: description: 'If the product requires a physical appointment, for example to request travel documents or for the booking of hotel rooms' type: boolean + audience: + description: 'The audience this product is intended for' + type: string required: - name - sourceOrganization @@ -5529,6 +5582,12 @@ definitions: type: string example: e2984465-190a-4562-829e-a8cca81aa35d format: uuid + icon: + description: 'The icon of this property' + type: string + example: 'My Property' + maxLength: 255 + minLength: 15 name: description: 'The name of this product group' type: string @@ -5562,6 +5621,12 @@ definitions: - sourceOrganization Group-write: properties: + icon: + description: 'The icon of this property' + type: string + example: 'My Property' + maxLength: 255 + minLength: 15 name: description: 'The name of this product group' type: string @@ -5602,11 +5667,13 @@ definitions: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR type: string offeredBy: @@ -5618,12 +5685,12 @@ definitions: availabilityEnds: description: 'the date this offer ends' type: string - example: '2020-01-13' + example: '2020-01-29' format: date availabilityStarts: description: 'the date this offer has started' type: string - example: '2020-01-13' + example: '2020-01-29' format: date product: description: 'The product that is sold via this offer' @@ -5656,11 +5723,13 @@ definitions: price: description: | The price of this product + @example 50.00 type: string priceCurrency: description: | The currency of this product in an [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format + @example EUR type: string offeredBy: @@ -5672,12 +5741,12 @@ definitions: availabilityEnds: description: 'the date this offer ends' type: string - example: '2020-01-13' + example: '2020-01-29' format: date availabilityStarts: description: 'the date this offer has started' type: string - example: '2020-01-13' + example: '2020-01-29' format: date product: description: 'The product that is sold via this offer' @@ -5747,8 +5816,7 @@ definitions: type: int example: '9' type: - description: 'The type of this product. **simple**: ,**set**: ,**virtual**: ,**external**: ,**ticket**: ,**variable**: ,**subscription**,**person**,**location**,**service**' - + description: 'The type of this product. **simple**, **set**, **virtual**, **external**, **ticket**, **variable**, **subscription**, **person**, **location**, **service**' type: string example: simple maxLength: 15 @@ -5771,6 +5839,9 @@ definitions: externalDocs: description: 'An array of URLs pointing to external documents referred to from this product' type: array + audience: + description: 'The audience this product is intended for' + type: string groups: description: 'The product groups that this product is a part of' type: \ArrayCollection @@ -5839,8 +5910,7 @@ definitions: type: int example: '9' type: - description: 'The type of this product. **simple**: ,**set**: ,**virtual**: ,**external**: ,**ticket**: ,**variable**: ,**subscription**,**person**,**location**,**service**' - + description: 'The type of this product. **simple**, **set**, **virtual**, **external**, **ticket**, **variable**, **subscription**, **person**, **location**, **service**' type: string example: simple maxLength: 15 @@ -5854,6 +5924,9 @@ definitions: description: 'If the product requires a physical appointment, for example to request travel documents or for the booking of hotel rooms' type: bool example: 'false' + audience: + description: 'The audience this product is intended for' + type: string groups: description: 'The product groups that this product is a part of' type: \ArrayCollection @@ -5883,7 +5956,7 @@ definitions: example: e2984465-190a-4562-829e-a8cca81aa35d format: uuid name: - description: 'The name of this RequestType' + description: 'The name of this Supplier' type: string example: 'My RequestType' maxLength: 255 @@ -5893,7 +5966,7 @@ definitions: example: '30280353' maxLength: 255 logo: - description: 'The logo for this component' + description: 'The logo for this supplier' type: string example: 'https://www.my-organization.com/logo.png' format: url @@ -5904,7 +5977,7 @@ definitions: Supplier-write: properties: name: - description: 'The name of this RequestType' + description: 'The name of this Supplier' type: string example: 'My RequestType' maxLength: 255 @@ -5914,7 +5987,7 @@ definitions: example: '30280353' maxLength: 255 logo: - description: 'The logo for this component' + description: 'The logo for this supplier' type: string example: 'https://www.my-organization.com/logo.png' format: url diff --git a/api/public/schema/publiccode.yaml b/api/public/schema/publiccode.yaml index 070bf1eb..3c6728b0 100644 --- a/api/public/schema/publiccode.yaml +++ b/api/public/schema/publiccode.yaml @@ -6,7 +6,7 @@ url: "https://github.com/ConductionNL/productenendienstencatalogus" landingURL: "pdc.zaakonline.nl" isBasedOn: "https://github.com/ConductionNL/Proto-component-commonground.git" softwareVersion: "V.0.1" -releaseDate: "2020-13-01" +releaseDate: "2020-29-01" logo: pc.zaakonline.nl monochromeLogo: img/logo-mono.svg diff --git a/api/src/Entity/Product.php b/api/src/Entity/Product.php index d3ef1414..77552b18 100644 --- a/api/src/Entity/Product.php +++ b/api/src/Entity/Product.php @@ -307,6 +307,15 @@ class Product */ private $externalDocs = []; + /** + * @var string The audience this product is intended for + * + * @Groups({"read","write"}) + * @Assert\Choice({"public", "internal"}) + * @ORM\Column(type="string", length=255, nullable=true) + */ + private $audience; + public function __construct() { $this->groups = new ArrayCollection(); @@ -687,4 +696,16 @@ public function setExternalDocs(?array $externalDocs): self return $this; } + + public function getAudience(): ?string + { + return $this->audience; + } + + public function setAudience(?string $audience): self + { + $this->audience = $audience; + + return $this; + } } From 4890fd5fbb6cbf736e25cc7a0027c1b3df5dea1a Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Wed, 29 Jan 2020 16:08:04 +0100 Subject: [PATCH 2/2] Adding "ringen" fixture --- api/src/DataFixtures/AppFixtures.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/api/src/DataFixtures/AppFixtures.php b/api/src/DataFixtures/AppFixtures.php index 63117e67..ce5ca536 100644 --- a/api/src/DataFixtures/AppFixtures.php +++ b/api/src/DataFixtures/AppFixtures.php @@ -368,7 +368,7 @@ public function load(ObjectManager $manager) $product = new Product(); $product->setName(v); $product->setSourceOrganization('002220647'); - $product->setDescription('U draagt zelf een trouwambtenaar voor en laat deze voor een dag beëdigd')); + $product->setDescription('U draagt zelf een trouwambtenaar voor en laat deze voor een dag be�digd')); $product->setType('simple'); $product->setCatalogue($utrecht); $product->setPrice('150.00'); @@ -505,6 +505,28 @@ public function load(ObjectManager $manager) $manager->persist($product); $manager->flush(); $product = $manager->getRepository('App:Product')->findOneBy(['id'=> $id]); + foreach ([$trouwenUtrecht, $trouwenExtraUtrecht] as $group) { + $product->addGroup($group); + } + + $id = Uuid::fromString('1fa3fbbc-0dee-442a-8431-3381b8cbc78a'); + $product = new Product(); + $product->setName('Ringen'); + $product->setSourceOrganization('002220647'); + $product->setDescription('Het uitwisselen van ringen tijdens de huwelijksceremonie'); + $product->setType('simple'); + $product->setCatalogue($utrecht); + $product->setPrice('10.00'); + $product->setPriceCurrency('EUR'); + $product->setTaxPercentage(0); + $product->setRequiresAppointment(false); + $product->setMovie('https://www.youtube.com/embed/DAaoMvj1Qbs'); + $manager->persist($product); + $product->setId($id); + $manager->persist($product); + $manager->flush(); + $product = $manager->getRepository('App:Product')->findOneBy(['id'=> $id]); + foreach ([$trouwenUtrecht, $trouwenExtraUtrecht] as $group) { $product->addGroup($group); }