Skip to content

Commit

Permalink
Feat/upload campaign documents (#92)
Browse files Browse the repository at this point in the history
* Upload files on campaign page

* update espace controller
  • Loading branch information
Lucieo authored Feb 27, 2024
1 parent f89b891 commit b5eb11d
Show file tree
Hide file tree
Showing 22 changed files with 470 additions and 34 deletions.
6 changes: 6 additions & 0 deletions back/api/application/documentation/1.0.0/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down
4 changes: 2 additions & 2 deletions back/api/application/models/application.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"via": "companyApplications"
},
"espace": {
"model": "espace",
"via": "applications"
"via": "applications",
"model": "espace"
},
"status": {
"type": "enumeration",
Expand Down
6 changes: 6 additions & 0 deletions back/api/booking/documentation/1.0.0/booking.json
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down
6 changes: 6 additions & 0 deletions back/api/city/documentation/1.0.0/city.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down
6 changes: 6 additions & 0 deletions back/api/disponibility/documentation/1.0.0/disponibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down
7 changes: 5 additions & 2 deletions back/api/espace/controllers/espace.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const populate = [
"images",
"files",
"users_permissions_user",
"city"
"city",
"campaign_files"
];

module.exports = {
Expand Down Expand Up @@ -110,9 +111,11 @@ module.exports = {

let entity;
if (ctx.is("multipart")) {
const { data, files } = parseMultipartData(ctx);
console.log(parseMultipartData(ctx))
const { data, files, campaign_files } = parseMultipartData(ctx);
entity = await strapi.services.espace.update({ id }, data, {
files,
campaign_files
});
} else {
const { files, ...body } = ctx.request.body;
Expand Down
70 changes: 70 additions & 0 deletions back/api/espace/documentation/1.0.0/espace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,76 @@
}
}
}
},
"campaign_files": {
"type": "array",
"items": {
"required": [
"id",
"name",
"hash",
"mime",
"size",
"url",
"provider"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {
"type": "object"
},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {
"type": "object"
},
"related": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
}
}
},
Expand Down
70 changes: 70 additions & 0 deletions back/api/espace/documentation/1.0.0/overrides/espace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,76 @@
"false",
"possible"
]
},
"campaign_files": {
"type": "array",
"items": {
"required": [
"id",
"name",
"hash",
"mime",
"size",
"url",
"provider"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {
"type": "object"
},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {
"type": "object"
},
"related": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions back/api/espace/models/espace.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@
"applications": {
"via": "espace",
"collection": "application"
},
"campaign_files": {
"collection": "file",
"via": "related",
"allowedTypes": [
"images",
"files",
"videos"
],
"plugin": "upload",
"required": false,
"pluginOptions": {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "02/26/2024 2:39:39 PM"
"x-generation-date": "02/27/2024 8:27:40 AM"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down Expand Up @@ -11523,6 +11523,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down Expand Up @@ -12367,6 +12373,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down Expand Up @@ -12633,6 +12645,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down Expand Up @@ -13698,6 +13716,76 @@
"false",
"possible"
]
},
"campaign_files": {
"type": "array",
"items": {
"required": [
"id",
"name",
"hash",
"mime",
"size",
"url",
"provider"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {
"type": "object"
},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {
"type": "object"
},
"related": {
"type": "string"
},
"created_by": {
"type": "string"
},
"updated_by": {
"type": "string"
}
}
}
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion back/extensions/documentation/public/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,12 @@
"type": "string"
}
},
"campaign_files": {
"type": "array",
"items": {
"type": "string"
}
},
"created_by": {
"type": "string"
},
Expand Down
Loading

0 comments on commit b5eb11d

Please sign in to comment.