From 4b786a904fc471c53fb4c4aed8c969433e8447d4 Mon Sep 17 00:00:00 2001 From: Agnieszka Figiel Date: Tue, 10 Oct 2023 16:49:01 +0200 Subject: [PATCH] Added location members / groups many-to-many relation --- .../content-types/location/schema.json | 12 + .../content-types/region-location/schema.json | 26 - .../controllers/region-location.ts | 7 - .../documentation/1.0.0/region-location.json | 507 ------------------ .../region-location/routes/region-location.ts | 7 - .../services/region-location.ts | 7 - 6 files changed, 12 insertions(+), 554 deletions(-) delete mode 100644 cms/src/api/region-location/content-types/region-location/schema.json delete mode 100644 cms/src/api/region-location/controllers/region-location.ts delete mode 100644 cms/src/api/region-location/documentation/1.0.0/region-location.json delete mode 100644 cms/src/api/region-location/routes/region-location.ts delete mode 100644 cms/src/api/region-location/services/region-location.ts diff --git a/cms/src/api/location/content-types/location/schema.json b/cms/src/api/location/content-types/location/schema.json index 19f10796..58bd9822 100644 --- a/cms/src/api/location/content-types/location/schema.json +++ b/cms/src/api/location/content-types/location/schema.json @@ -31,6 +31,18 @@ "type": { "type": "string", "required": true + }, + "groups": { + "type": "relation", + "relation": "manyToMany", + "target": "api::location.location", + "inversedBy": "members" + }, + "members": { + "type": "relation", + "relation": "manyToMany", + "target": "api::location.location", + "inversedBy": "groups" } } } diff --git a/cms/src/api/region-location/content-types/region-location/schema.json b/cms/src/api/region-location/content-types/region-location/schema.json deleted file mode 100644 index acfceb4b..00000000 --- a/cms/src/api/region-location/content-types/region-location/schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "kind": "collectionType", - "collectionName": "region_locations", - "info": { - "singularName": "region-location", - "pluralName": "region-locations", - "displayName": "Region Location", - "description": "" - }, - "options": { - "draftAndPublish": false - }, - "pluginOptions": {}, - "attributes": { - "region": { - "type": "relation", - "relation": "oneToOne", - "target": "api::location.location" - }, - "location": { - "type": "relation", - "relation": "oneToOne", - "target": "api::location.location" - } - } -} diff --git a/cms/src/api/region-location/controllers/region-location.ts b/cms/src/api/region-location/controllers/region-location.ts deleted file mode 100644 index 4ab8acc8..00000000 --- a/cms/src/api/region-location/controllers/region-location.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * region-location controller - */ - -import { factories } from '@strapi/strapi' - -export default factories.createCoreController('api::region-location.region-location'); diff --git a/cms/src/api/region-location/documentation/1.0.0/region-location.json b/cms/src/api/region-location/documentation/1.0.0/region-location.json deleted file mode 100644 index 64fa433f..00000000 --- a/cms/src/api/region-location/documentation/1.0.0/region-location.json +++ /dev/null @@ -1,507 +0,0 @@ -{ - "/region-locations": { - "get": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationListResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Region-location" - ], - "parameters": [ - { - "name": "sort", - "in": "query", - "description": "Sort by attributes ascending (asc) or descending (desc)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "pagination[withCount]", - "in": "query", - "description": "Return page/pageSize (default: true)", - "deprecated": false, - "required": false, - "schema": { - "type": "boolean" - } - }, - { - "name": "pagination[page]", - "in": "query", - "description": "Page number (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[pageSize]", - "in": "query", - "description": "Page size (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[start]", - "in": "query", - "description": "Offset value (default: 0)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "pagination[limit]", - "in": "query", - "description": "Number of entities to return (default: 25)", - "deprecated": false, - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "fields", - "in": "query", - "description": "Fields to return (ex: title,author)", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "populate", - "in": "query", - "description": "Relations to return", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "filters", - "in": "query", - "description": "Filters to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "object" - }, - "style": "deepObject" - }, - { - "name": "locale", - "in": "query", - "description": "Locale to apply", - "deprecated": false, - "required": false, - "schema": { - "type": "string" - } - } - ], - "operationId": "get/region-locations" - }, - "post": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Region-location" - ], - "parameters": [], - "operationId": "post/region-locations", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationRequest" - } - } - } - } - } - }, - "/region-locations/{id}": { - "get": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Region-location" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } - ], - "operationId": "get/region-locations/{id}" - }, - "put": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationResponse" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Region-location" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } - ], - "operationId": "put/region-locations/{id}", - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegionLocationRequest" - } - } - } - } - }, - "delete": { - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "integer", - "format": "int64" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - }, - "tags": [ - "Region-location" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "", - "deprecated": false, - "required": true, - "schema": { - "type": "number" - } - } - ], - "operationId": "delete/region-locations/{id}" - } - } -} diff --git a/cms/src/api/region-location/routes/region-location.ts b/cms/src/api/region-location/routes/region-location.ts deleted file mode 100644 index 12823395..00000000 --- a/cms/src/api/region-location/routes/region-location.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * region-location router - */ - -import { factories } from '@strapi/strapi'; - -export default factories.createCoreRouter('api::region-location.region-location'); diff --git a/cms/src/api/region-location/services/region-location.ts b/cms/src/api/region-location/services/region-location.ts deleted file mode 100644 index 90088125..00000000 --- a/cms/src/api/region-location/services/region-location.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * region-location service - */ - -import { factories } from '@strapi/strapi'; - -export default factories.createCoreService('api::region-location.region-location');