Merge pull request 'Upgrade vers la v5.42.1 de Strapi' (#2) from v5-upgrade into master

Reviewed-on: https://codeberg.org/OKI/api.oki.re/pulls/2
This commit is contained in:
Cédric Famibelle-Pronzola
2026-04-22 05:31:17 +02:00
11 changed files with 5467 additions and 4598 deletions
-4
View File
@@ -2,9 +2,7 @@
* This file was automatically generated by Strapi. * This file was automatically generated by Strapi.
* Any modifications made will be discarded. * Any modifications made will be discarded.
*/ */
import i18N from "@strapi/plugin-i18n/strapi-admin";
import usersPermissions from "@strapi/plugin-users-permissions/strapi-admin"; import usersPermissions from "@strapi/plugin-users-permissions/strapi-admin";
import restCache from "strapi-plugin-rest-cache/strapi-admin";
import { renderAdmin } from "@strapi/strapi/admin"; import { renderAdmin } from "@strapi/strapi/admin";
import customisations from "../../src/admin/app.js"; import customisations from "../../src/admin/app.js";
@@ -13,8 +11,6 @@ renderAdmin(document.getElementById("strapi"), {
customisations, customisations,
plugins: { plugins: {
i18n: i18N,
"users-permissions": usersPermissions, "users-permissions": usersPermissions,
"rest-cache": restCache,
}, },
}); });
+2 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<!-- <!--
This file was automatically generated by Strapi. This file was automatically generated by Strapi.
@@ -58,5 +58,6 @@ Any modifications made will be discarded.
</div> </div>
</div></noscript </div></noscript
> >
<script type="module" src="/.strapi/client/app.js"></script>
</body> </body>
</html> </html>
+4 -7
View File
@@ -21,19 +21,16 @@
}, },
"devDependencies": {}, "devDependencies": {},
"dependencies": { "dependencies": {
"@strapi/plugin-i18n": "4.26.1", "@strapi/plugin-users-permissions": "5.42.1",
"@strapi/plugin-users-permissions": "4.26.1",
"@strapi/provider-email-nodemailer": "^4.26.1", "@strapi/provider-email-nodemailer": "^4.26.1",
"@strapi/strapi": "4.26.1", "@strapi/strapi": "5.42.1",
"better-sqlite3": "^12.9.0", "better-sqlite3": "^12.9.0",
"diff": "^5.1.0", "diff": "^5.1.0",
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-router-dom": "^5.2.0", "react-router-dom": "^6.0.0",
"slugify": "^1.6.5", "slugify": "^1.6.5",
"strapi-plugin-rest-cache": "^4.2.4", "styled-components": "^6.0.0",
"strapi-provider-rest-cache-memory": "^4.2.4",
"styled-components": "^5.2.1",
"yup": "^1.7.1" "yup": "^1.7.1"
}, },
"strapi": { "strapi": {
@@ -1,10 +1,5 @@
'use strict'; 'use strict';
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/models.html#lifecycle-hooks)
* to customize this model
*/
const { ApplicationError } = require("@strapi/utils").errors const { ApplicationError } = require("@strapi/utils").errors
const slugify = require('slugify') const slugify = require('slugify')
+4 -2
View File
@@ -26,7 +26,9 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
} }
} }
const user = await strapi.entityService.findOne('plugin::users-permissions.user', body.data.user.id) const user = await strapi.documents('plugin::users-permissions.user').findOne({
documentId: "__TODO__"
})
if (!user) { if (!user) {
throw new NotFoundError('Utilisateur introuvable.') throw new NotFoundError('Utilisateur introuvable.')
@@ -43,7 +45,7 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
if (artiste) { if (artiste) {
return artiste return artiste
} else { } else {
const newArtiste = await strapi.entityService.create('api::artiste.artiste', { const newArtiste = await strapi.documents('api::artiste.artiste').create({
data: { data: {
...data ...data
} }
@@ -21,7 +21,9 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
throw new UnauthorizedError(ctx, err, 'Opération non autorisée') throw new UnauthorizedError(ctx, err, 'Opération non autorisée')
} }
} }
const user = await strapi.entityService.findOne('plugin::users-permissions.user', body.data.user.id) const user = await strapi.documents('plugin::users-permissions.user').findOne({
documentId: "__TODO__"
})
if (!user) { if (!user) {
throw new NotFoundError('Utilisateur introuvable.') throw new NotFoundError('Utilisateur introuvable.')
@@ -33,7 +35,8 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
data.user = user.id data.user = user.id
const parole = await strapi.entityService.findOne('api::parole.parole', data.parole, { const parole = await strapi.documents('api::parole.parole').findOne({
documentId: "__TODO__",
fields: ['id'] fields: ['id']
}) })
@@ -41,13 +44,15 @@ module.exports = createCoreController('api::commentaire.commentaire', ({strapi})
throw new NotFoundError('Texte introuvable.') throw new NotFoundError('Texte introuvable.')
} }
const newCommentaire = await strapi.entityService.create('api::commentaire.commentaire', { const newCommentaire = await strapi.documents('api::commentaire.commentaire').create({
data: { data: {
...data ...data
} }
}) })
await strapi.entityService.update('api::parole.parole', parole.id, { await strapi.documents('api::parole.parole').update({
documentId: "__TODO__",
data: { data: {
commentaires: [newCommentaire.id] commentaires: [newCommentaire.id]
} }
+16 -7
View File
@@ -5,7 +5,8 @@ const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::parole.parole', ({strapi}) => ({ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
async findOne(ctx) { async findOne(ctx) {
const {id} = ctx.params const {id} = ctx.params
const parole = await strapi.entityService.findOne('api::parole.parole', id, { const parole = await strapi.documents('api::parole.parole').findOne({
documentId: "__TODO__",
populate: ['artistes'] populate: ['artistes']
}) })
return parole return parole
@@ -14,7 +15,9 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
const {body} = ctx.request const {body} = ctx.request
const {data} = body const {data} = body
const updatedParole = await strapi.entityService.update('api::parole.parole', data.id, { const updatedParole = await strapi.documents('api::parole.parole').update({
documentId: "__TODO__",
data: { data: {
...data ...data
} }
@@ -41,7 +44,9 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
} }
} }
const user = await strapi.entityService.findOne('plugin::users-permissions.user', body.data.user.id) const user = await strapi.documents('plugin::users-permissions.user').findOne({
documentId: "__TODO__"
})
if (!user) { if (!user) {
ctx.notFound('Utilisateur introuvable.') ctx.notFound('Utilisateur introuvable.')
@@ -51,13 +56,15 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
ctx.badRequest('Informations non valides.') ctx.badRequest('Informations non valides.')
} }
const artiste = await strapi.entityService.findOne('api::artiste.artiste', data.artistes[0]) const artiste = await strapi.documents('api::artiste.artiste').findOne({
documentId: "__TODO__"
})
if (!artiste) { if (!artiste) {
ctx.notFound('Artiste introuvable.') ctx.notFound('Artiste introuvable.')
} }
const currentUserParole = await strapi.entityService.findMany('api::parole.parole', { const currentUserParole = await strapi.documents('api::parole.parole').findMany({
fields: ['id'], fields: ['id'],
filters: { filters: {
user: { user: {
@@ -77,7 +84,7 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
data.traductions = translated data.traductions = translated
} }
const newParole = await strapi.entityService.create('api::parole.parole', { const newParole = await strapi.documents('api::parole.parole').create({
data: { data: {
...data ...data
} }
@@ -86,7 +93,9 @@ module.exports = createCoreController('api::parole.parole', ({strapi}) => ({
const parolesIds = currentUserParole.map(({id}) => id) const parolesIds = currentUserParole.map(({id}) => id)
parolesIds.push(newParole.id) parolesIds.push(newParole.id)
await strapi.entityService.update('plugin::users-permissions.user', user.id, { await strapi.documents('plugin::users-permissions.user').update({
documentId: "__TODO__",
data: { data: {
paroles: parolesIds paroles: parolesIds
} }
+6 -7
View File
@@ -2,13 +2,12 @@
module.exports = { module.exports = {
async count(ctx, next) { async count(ctx, next) {
const countArtiste = await strapi.entityService.count('api::artiste.artiste') const countArtiste = await strapi.documents('api::artiste.artiste').count({
const countParole = await strapi.entityService.count('api::parole.parole', { publicationState: 'live'
filters: { })
publishedAt: {
$notNull: true, const countParole = await strapi.documents('api::parole.parole').count({
} publicationState: 'live'
}
}) })
return {countArtiste, countParole} return {countArtiste, countParole}
+24 -28
View File
@@ -1,6 +1,6 @@
import type { Attribute, Schema } from '@strapi/strapi'; import type { Schema, Struct } from '@strapi/strapi';
export interface DifferenceParolesDiff extends Schema.Component { export interface DifferenceParolesDiff extends Struct.ComponentSchema {
collectionName: 'components_diff_paroles_diffs'; collectionName: 'components_diff_paroles_diffs';
info: { info: {
description: ''; description: '';
@@ -8,28 +8,24 @@ export interface DifferenceParolesDiff extends Schema.Component {
icon: 'american-sign-language-interpreting'; icon: 'american-sign-language-interpreting';
}; };
attributes: { attributes: {
admin_user: Attribute.Relation< admin_user: Schema.Attribute.Relation<'oneToOne', 'admin::user'>;
'difference.paroles-diff', date: Schema.Attribute.DateTime;
'oneToOne', jsonDiff: Schema.Attribute.JSON;
'admin::user' paroles: Schema.Attribute.RichText;
>; sources: Schema.Attribute.Enumeration<
date: Attribute.DateTime;
jsonDiff: Attribute.JSON;
paroles: Attribute.RichText;
sources: Attribute.Enumeration<
[ [
'transcription', 'transcription',
'francais', 'francais',
'anglais', 'anglais',
'espagnol', 'espagnol',
'allemand', 'allemand',
'italien' 'italien',
] ]
>; >;
}; };
} }
export interface StoreAlbum extends Schema.Component { export interface StoreAlbum extends Struct.ComponentSchema {
collectionName: 'components_store_albums'; collectionName: 'components_store_albums';
info: { info: {
description: ''; description: '';
@@ -37,7 +33,7 @@ export interface StoreAlbum extends Schema.Component {
icon: 'music'; icon: 'music';
}; };
attributes: { attributes: {
plateforme: Attribute.Enumeration< plateforme: Schema.Attribute.Enumeration<
[ [
'Tidal', 'Tidal',
'Spotify', 'Spotify',
@@ -46,14 +42,14 @@ export interface StoreAlbum extends Schema.Component {
'Youtubemusic', 'Youtubemusic',
'Applemusic', 'Applemusic',
'Amazon', 'Amazon',
'Soundcloud' 'Soundcloud',
] ]
>; >;
url: Attribute.String; url: Schema.Attribute.String;
}; };
} }
export interface TradTraductions extends Schema.Component { export interface TradTraductions extends Struct.ComponentSchema {
collectionName: 'components_trad_traductions'; collectionName: 'components_trad_traductions';
info: { info: {
description: ''; description: '';
@@ -61,15 +57,15 @@ export interface TradTraductions extends Schema.Component {
icon: 'spell-check'; icon: 'spell-check';
}; };
attributes: { attributes: {
allemand: Attribute.RichText; allemand: Schema.Attribute.RichText;
anglais: Attribute.RichText; anglais: Schema.Attribute.RichText;
espagnol: Attribute.RichText; espagnol: Schema.Attribute.RichText;
francais: Attribute.RichText; francais: Schema.Attribute.RichText;
italien: Attribute.RichText; italien: Schema.Attribute.RichText;
}; };
} }
export interface UrlLiens extends Schema.Component { export interface UrlLiens extends Struct.ComponentSchema {
collectionName: 'components_url_liens'; collectionName: 'components_url_liens';
info: { info: {
description: ''; description: '';
@@ -77,16 +73,16 @@ export interface UrlLiens extends Schema.Component {
icon: 'hand-pointer'; icon: 'hand-pointer';
}; };
attributes: { attributes: {
plateforme: Attribute.Enumeration< plateforme: Schema.Attribute.Enumeration<
['Youtube', 'Gad\u00E9', 'Dailymotion', 'Vimeo', 'File', 'Lbry', 'Rumble'] ['Youtube', 'Gad\u00E9', 'Dailymotion', 'Vimeo', 'File', 'Lbry', 'Rumble']
>; >;
url: Attribute.String; url: Schema.Attribute.String;
}; };
} }
declare module '@strapi/types' { declare module '@strapi/strapi' {
export module Shared { export module Public {
export interface Components { export interface ComponentSchemas {
'difference.paroles-diff': DifferenceParolesDiff; 'difference.paroles-diff': DifferenceParolesDiff;
'store.album': StoreAlbum; 'store.album': StoreAlbum;
'trad.traductions': TradTraductions; 'trad.traductions': TradTraductions;
+634 -520
View File
File diff suppressed because it is too large Load Diff
+4768 -4013
View File
File diff suppressed because it is too large Load Diff