0.12.17 : change ad feature
All checks were successful
Build release Docker image / Build Docker Images (push) Successful in 7m25s
All checks were successful
Build release Docker image / Build Docker Images (push) Successful in 7m25s
This commit is contained in:
@@ -42,11 +42,6 @@
|
||||
"applies": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"type": "component",
|
||||
"repeatable": false,
|
||||
"component": "address.full-address"
|
||||
},
|
||||
"contactname": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -58,6 +53,19 @@
|
||||
},
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"location": {
|
||||
"type": "text"
|
||||
},
|
||||
"medias": {
|
||||
"allowedTypes": [
|
||||
"images",
|
||||
"files",
|
||||
"videos",
|
||||
"audios"
|
||||
],
|
||||
"type": "media",
|
||||
"multiple": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,47 @@
|
||||
* ad controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi'
|
||||
import { factories } from "@strapi/strapi";
|
||||
|
||||
export default factories.createCoreController('api::ad.ad');
|
||||
export default factories.createCoreController("api::ad.ad", ({ strapi }) => ({
|
||||
async create(ctx) {
|
||||
// 1) Prépare le payload + upload banner
|
||||
const body = ctx.request.body as any;
|
||||
const data =
|
||||
typeof body?.data === "string" ? JSON.parse(body.data) : body?.data || {};
|
||||
data.author = ctx.state.user.id;
|
||||
data.medias = [];
|
||||
|
||||
const bannerInput = (ctx.request.files as any)?.medias;
|
||||
if (bannerInput) {
|
||||
const files = Array.isArray(bannerInput) ? bannerInput : [bannerInput];
|
||||
|
||||
for (const file of files) {
|
||||
const uploaded = await strapi
|
||||
.plugin("upload")
|
||||
.service("upload")
|
||||
.upload({
|
||||
data: {
|
||||
fileInfo: {
|
||||
alternativeText: data?.name || "media",
|
||||
caption: "media",
|
||||
name: file.originalFilename || "media",
|
||||
},
|
||||
},
|
||||
files: file,
|
||||
});
|
||||
|
||||
if (uploaded?.[0]?.id) {
|
||||
data.medias.push(uploaded[0].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//delete data.medias;
|
||||
|
||||
// 2) Crée le group via core controller
|
||||
ctx.request.body = { data };
|
||||
const response = await super.create(ctx); // { data: { id, attributes }, meta: {} }
|
||||
return response;
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "Apache 2.0",
|
||||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
},
|
||||
"x-generation-date": "2025-12-12T18:29:01.167Z"
|
||||
"x-generation-date": "2026-01-15T08:01:40.043Z"
|
||||
},
|
||||
"x-strapi-config": {
|
||||
"plugins": [
|
||||
@@ -16533,9 +16533,6 @@
|
||||
"applies": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"$ref": "#/components/schemas/AddressFullAddressComponent"
|
||||
},
|
||||
"contactname": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -16548,6 +16545,23 @@
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"medias": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"example": "string or id"
|
||||
}
|
||||
},
|
||||
"locale": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -20282,9 +20296,6 @@
|
||||
"applies": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"$ref": "#/components/schemas/AddressFullAddressComponent"
|
||||
},
|
||||
"contactname": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -20297,6 +20308,141 @@
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"medias": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"alternativeText": {
|
||||
"type": "string"
|
||||
},
|
||||
"caption": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "integer"
|
||||
},
|
||||
"height": {
|
||||
"type": "integer"
|
||||
},
|
||||
"formats": {},
|
||||
"hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"ext": {
|
||||
"type": "string"
|
||||
},
|
||||
"mime": {
|
||||
"type": "string"
|
||||
},
|
||||
"size": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"previewUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider_metadata": {},
|
||||
"related": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"folder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"folderPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"publishedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"updatedBy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"locale": {
|
||||
"type": "string"
|
||||
},
|
||||
"localizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -20382,9 +20528,6 @@
|
||||
"applies": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"$ref": "#/components/schemas/AddressFullAddressComponent"
|
||||
},
|
||||
"contactname": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -20397,6 +20540,141 @@
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"medias": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"alternativeText": {
|
||||
"type": "string"
|
||||
},
|
||||
"caption": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "integer"
|
||||
},
|
||||
"height": {
|
||||
"type": "integer"
|
||||
},
|
||||
"formats": {},
|
||||
"hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"ext": {
|
||||
"type": "string"
|
||||
},
|
||||
"mime": {
|
||||
"type": "string"
|
||||
},
|
||||
"size": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
"url": {
|
||||
"type": "string"
|
||||
},
|
||||
"previewUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider_metadata": {},
|
||||
"related": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"folder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"folderPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"publishedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"createdBy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"updatedBy": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"locale": {
|
||||
"type": "string"
|
||||
},
|
||||
"localizations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"documentId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
@@ -20464,40 +20742,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"AddressFullAddressComponent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number"
|
||||
},
|
||||
"freeaddress": {
|
||||
"type": "string"
|
||||
},
|
||||
"housenumber": {
|
||||
"type": "string"
|
||||
},
|
||||
"road": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"long": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
"lat": {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SocialTagsComponent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user