Compare commits
22 Commits
c2a32f11b8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f7f0ee17d7 | |||
| 0648bf74bd | |||
| d469fc41e8 | |||
| 5af0f28b39 | |||
| fd14d20dd0 | |||
| 7d020c33b6 | |||
| 1a3ea9e0c1 | |||
| b0db6a5ddf | |||
| f13efb8707 | |||
| 75c90aa042 | |||
| 616b14edca | |||
| 42604b037b | |||
| 297dea3925 | |||
| 1f50e645ac | |||
| 56b913e888 | |||
| ce9d05cd5c | |||
| d4e6a1192e | |||
| ba0c076f70 | |||
| 39046c8d35 | |||
| bc63c56da6 | |||
| ce37fafddf | |||
| 04c4f7839f |
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# .dockerignore
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.tmp
|
||||||
|
.cache
|
||||||
|
.env
|
||||||
|
build
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$HOME/.nvm/nvm.sh"
|
#. "$HOME/.nvm/nvm.sh"
|
||||||
node scripts/check-version.js
|
#node scripts/check-version.js
|
||||||
44
Dockerfile
44
Dockerfile
@@ -1,30 +1,36 @@
|
|||||||
# Creating multi-stage build for production
|
# --- ÉTAPE 1 : BUILD ---
|
||||||
FROM node:18-alpine AS build
|
FROM node:20-alpine AS build-stage
|
||||||
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
|
RUN apk update && apk add --no-cache \
|
||||||
|
build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
|
||||||
|
|
||||||
ARG NODE_ENV=production
|
ARG NODE_ENV=production
|
||||||
ENV NODE_ENV=${NODE_ENV}
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
|
||||||
WORKDIR /opt/
|
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
RUN npm install -g node-gyp
|
|
||||||
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install --only=production
|
|
||||||
ENV PATH=/opt/node_modules/.bin:$PATH
|
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Creating final production image
|
# On force le build de l'admin explicitement pour être sûr que le dossier existe
|
||||||
FROM node:18-alpine
|
RUN yarn build
|
||||||
RUN apk add --no-cache vips-dev
|
|
||||||
|
# --- ÉTAPE 2 : RUNTIME ---
|
||||||
|
FROM node:20-alpine AS runtime-stage
|
||||||
|
RUN apk add --no-cache vips-dev libpng libjpeg-turbo
|
||||||
|
|
||||||
ARG NODE_ENV=production
|
ARG NODE_ENV=production
|
||||||
ENV NODE_ENV=${NODE_ENV}
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
WORKDIR /opt/
|
|
||||||
COPY --from=build /opt/node_modules ./node_modules
|
|
||||||
WORKDIR /opt/app
|
|
||||||
COPY --from=build /opt/app ./
|
|
||||||
ENV PATH=/opt/node_modules/.bin:$PATH
|
|
||||||
|
|
||||||
RUN chown -R node:node /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
|
# ASTUCE : On copie tout l'objet de build avec --chown
|
||||||
|
# Cela évite de lister les dossiers un par un et de risquer un "Not Found"
|
||||||
|
COPY --from=build-stage --chown=node:node /opt/app ./
|
||||||
|
|
||||||
|
# On expose le binaire
|
||||||
|
ENV PATH=/opt/app/node_modules/.bin:$PATH
|
||||||
|
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 1337
|
EXPOSE 1337
|
||||||
CMD ["npm", "run", "start"]
|
|
||||||
|
CMD ["yarn", "start"]
|
||||||
@@ -1,57 +1,28 @@
|
|||||||
export default [
|
export default [
|
||||||
"strapi::logger",
|
"strapi::logger",
|
||||||
"strapi::errors",
|
"strapi::errors",
|
||||||
//'strapi::security',
|
"strapi::security",
|
||||||
{
|
"strapi::cors",
|
||||||
name: "strapi::security",
|
|
||||||
config: {
|
|
||||||
contentSecurityPolicy: {
|
|
||||||
useDefaults: true,
|
|
||||||
directives: {
|
|
||||||
"connect-src": ["'self'", "https:", "http:"],
|
|
||||||
"img-src": [
|
|
||||||
"'self'",
|
|
||||||
"data:",
|
|
||||||
"blob:",
|
|
||||||
"market-assets.strapi.io",
|
|
||||||
"192.168.0.211:9000",
|
|
||||||
"container.harmonylab.ovh",
|
|
||||||
],
|
|
||||||
"media-src": [
|
|
||||||
"'self'",
|
|
||||||
"data:",
|
|
||||||
"blob:",
|
|
||||||
"market-assets.strapi.io",
|
|
||||||
"192.168.0.211:9000",
|
|
||||||
"container.harmonylab.ovh",
|
|
||||||
],
|
|
||||||
upgradeInsecureRequests: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "strapi::cors",
|
|
||||||
config: {
|
|
||||||
origin: ["https://back.harmonylab.ovh", "https://www.choralsync.com"],
|
|
||||||
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
|
|
||||||
headers: ["Content-Type", "Authorization", "Origin", "Accept"],
|
|
||||||
keepHeadersOnError: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"strapi::poweredBy",
|
"strapi::poweredBy",
|
||||||
"strapi::query",
|
"strapi::query",
|
||||||
"strapi::body",
|
|
||||||
{
|
{
|
||||||
name: 'strapi::session',
|
name: "strapi::body",
|
||||||
config: {
|
config: {
|
||||||
cookie: {
|
includeUnparsed: true, // INDISPENSABLE pour les webhooks
|
||||||
secure: true, // Force car tu es sur https://back.harmonylab.ovh
|
},
|
||||||
sameSite: 'lax',
|
},
|
||||||
httpOnly: true,
|
{
|
||||||
|
name: "strapi::session",
|
||||||
|
config: {
|
||||||
|
// Nom unique pour être sûr que le navigateur ne garde pas un vieux cookie
|
||||||
|
key: "strapi_session_local_debug",
|
||||||
|
maxAge: 86400000,
|
||||||
|
httpOnly: true,
|
||||||
|
// FORCE à false pour que ça marche en HTTP local
|
||||||
|
secure: false,
|
||||||
|
sameSite: "lax",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
"strapi::favicon",
|
"strapi::favicon",
|
||||||
"strapi::public",
|
"strapi::public",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,16 +3,18 @@ export default () => ({
|
|||||||
config: {
|
config: {
|
||||||
provider: "nodemailer",
|
provider: "nodemailer",
|
||||||
providerOptions: {
|
providerOptions: {
|
||||||
host: "mail.harmonychoral.com",
|
host: "smtp.zeptomail.eu",
|
||||||
port: 465,
|
port: 587,
|
||||||
auth: {
|
auth: {
|
||||||
user: "admin@harmonychoral.com",
|
user: "emailapikey",
|
||||||
pass: "Apslxnap12bn23",
|
pass: "yA6KbHsJ4lrywWtTFUc+0pSC94lm/aE/2nzks3i2fpZ1LYXp3qE71RBvd4O4c2CLjdfT5a9UbIkVJoCwvIpbfpczPIBXJpTGTuv4P2uV48xh8ciEYNYjhJivALIWFqVOeBsnDyo4QfEjWA==",
|
||||||
},
|
},
|
||||||
|
debug: true,
|
||||||
|
logger: true,
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
defaultFrom: "admin@harmonychoral.com",
|
defaultFrom: "ChoralSync <noreply@choralsync.com>",
|
||||||
defaultReplyTo: "admin@harmonychoral.com",
|
defaultReplyTo: "contact@choralsync.com",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,24 +1,34 @@
|
|||||||
import cronTasks from "./cron-tasks";
|
import cronTasks from "./cron-tasks";
|
||||||
|
|
||||||
export default ({ env }) => ({
|
export default ({ env }) => {
|
||||||
host: env("HOST", "0.0.0.0"),
|
// DEBUG: On vérifie ce que Strapi reçoit vraiment
|
||||||
port: env.int("PORT", 1337),
|
//const appKeys = env.array("APP_KEYS");
|
||||||
proxy: true,
|
const appKeys = env.array("APP_KEYS", ["defaultKey1", "defaultKey2"]);
|
||||||
url: env('STRAPI_URL'),
|
console.log("------------------------------------------------");
|
||||||
app: {
|
console.log("Key Check:", appKeys.length > 0 ? "CHARGÉES ✅" : "VIDES ❌");
|
||||||
keys: env.array("APP_KEYS"),
|
console.log("Key Type:", typeof appKeys[0]); // Doit afficher 'string'
|
||||||
},
|
console.log("Host:", env("HOST", "0.0.0.0"));
|
||||||
cron: {
|
console.log("------------------------------------------------");
|
||||||
enabled: true,
|
return {
|
||||||
tasks: cronTasks,
|
host: env("HOST", "0.0.0.0"),
|
||||||
},
|
port: env.int("PORT", 1337),
|
||||||
admin: {
|
url: env("STRAPI_URL", "http://localhost:1337"),
|
||||||
auth: {
|
app: {
|
||||||
events: {
|
// ON FORCE UN TABLEAU EN DUR ICI :
|
||||||
onConnectionSuccess(e) {
|
keys: [
|
||||||
console.log('Login success for:', e.user.email);
|
"UneSuperClefSecreteTresLongueEtAleatoire123",
|
||||||
},
|
"UneAutreClefDeSecours456",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
cron: {
|
||||||
|
enabled: true,
|
||||||
|
tasks: cronTasks,
|
||||||
|
},
|
||||||
|
proxy: false,
|
||||||
|
admin: {
|
||||||
|
auth: {
|
||||||
|
secret: env("ADMIN_JWT_SECRET"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
});
|
};
|
||||||
|
|||||||
24577
package-lock.json
generated
24577
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "harmony-back",
|
"name": "harmony-back",
|
||||||
"version": "0.13.1",
|
"version": "0.13.10",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "A Strapi application",
|
"description": "A Strapi application",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -26,9 +26,11 @@
|
|||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.30.3",
|
"react-router-dom": "^6.30.3",
|
||||||
"strapi-v5-plugin-populate-deep": "^4.0.5",
|
"strapi-v5-plugin-populate-deep": "^4.0.5",
|
||||||
|
"stripe": "^20.4.0",
|
||||||
"styled-components": "^6.0.0"
|
"styled-components": "^6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/minimatch": "^6.0.0",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^18",
|
"@types/react": "^18",
|
||||||
"@types/react-dom": "^18",
|
"@types/react-dom": "^18",
|
||||||
|
|||||||
@@ -58,14 +58,15 @@
|
|||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
"medias": {
|
"medias": {
|
||||||
|
"type": "media",
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
"allowedTypes": [
|
"allowedTypes": [
|
||||||
"images",
|
"images",
|
||||||
"files",
|
"files",
|
||||||
"videos",
|
"videos",
|
||||||
"audios"
|
"audios"
|
||||||
],
|
]
|
||||||
"type": "media",
|
|
||||||
"multiple": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
"info": {
|
"info": {
|
||||||
"singularName": "channel",
|
"singularName": "channel",
|
||||||
"pluralName": "channels",
|
"pluralName": "channels",
|
||||||
"displayName": "Channel"
|
"displayName": "Channel",
|
||||||
|
"description": ""
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"draftAndPublish": false
|
"draftAndPublish": false
|
||||||
@@ -33,6 +34,12 @@
|
|||||||
"relation": "oneToMany",
|
"relation": "oneToMany",
|
||||||
"target": "api::message.message",
|
"target": "api::message.message",
|
||||||
"mappedBy": "channel"
|
"mappedBy": "channel"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"type": "json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,29 @@
|
|||||||
"type": "component",
|
"type": "component",
|
||||||
"repeatable": true,
|
"repeatable": true,
|
||||||
"component": "user.permissions"
|
"component": "user.permissions"
|
||||||
|
},
|
||||||
|
"role_id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"permission_exceptions": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"state": {
|
||||||
|
"type": "enumeration",
|
||||||
|
"enum": [
|
||||||
|
"active",
|
||||||
|
"pending_user_approval",
|
||||||
|
"pending_admin_approval",
|
||||||
|
"decline"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"invite_email": {
|
||||||
|
"type": "email",
|
||||||
|
"private": true
|
||||||
|
},
|
||||||
|
"invite_token": {
|
||||||
|
"type": "string",
|
||||||
|
"private": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,97 @@
|
|||||||
/**
|
import { factories } from "@strapi/strapi";
|
||||||
* choral-membership controller
|
import crypto from "crypto";
|
||||||
*/
|
|
||||||
|
|
||||||
import { factories } from '@strapi/strapi'
|
export default factories.createCoreController(
|
||||||
|
"api::choral-membership.choral-membership",
|
||||||
|
({ strapi }) => ({
|
||||||
|
async create(ctx) {
|
||||||
|
const { data } = ctx.request.body;
|
||||||
|
const inviter = ctx.state.user;
|
||||||
|
|
||||||
export default factories.createCoreController('api::choral-membership.choral-membership');
|
// 1. Déterminer le type d'invitation
|
||||||
|
const isExternalInvite = !!data.invite_email && !data.user;
|
||||||
|
const isInternalInvite = !!data.user;
|
||||||
|
|
||||||
|
let token = null;
|
||||||
|
let targetEmail = null;
|
||||||
|
|
||||||
|
// 2. Configuration commune
|
||||||
|
// On force le statut "en attente" peut importe le type d'invité
|
||||||
|
ctx.request.body.data.state = "pending_user_approval";
|
||||||
|
if (!data.role) {
|
||||||
|
ctx.request.body.data.role = "member";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Traitement spécifique selon le cas
|
||||||
|
if (isExternalInvite) {
|
||||||
|
// Cas A : Utilisateur externe (Token requis)
|
||||||
|
token = crypto.randomBytes(32).toString("hex");
|
||||||
|
ctx.request.body.data.invite_token = token;
|
||||||
|
ctx.request.body.data.invite_email = data.invite_email.toLowerCase();
|
||||||
|
targetEmail = data.invite_email.toLowerCase();
|
||||||
|
} else if (isInternalInvite) {
|
||||||
|
// Cas B : Utilisateur existant (Pas de token)
|
||||||
|
// On s'assure de nettoyer les champs d'invitation externe au cas où le front les enverrait par erreur
|
||||||
|
ctx.request.body.data.invite_token = null;
|
||||||
|
ctx.request.body.data.invite_email = null;
|
||||||
|
|
||||||
|
// On récupère l'email de l'utilisateur existant pour lui envoyer une notification
|
||||||
|
const invitedUser = await strapi
|
||||||
|
.documents("plugin::users-permissions.user")
|
||||||
|
.findMany({
|
||||||
|
filters: {
|
||||||
|
id: data.user,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (invitedUser && invitedUser.length > 0) {
|
||||||
|
targetEmail = invitedUser[0].email;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Exécution de la création native par Strapi
|
||||||
|
const response = await super.create(ctx);
|
||||||
|
|
||||||
|
// 5. Post-traitement : Envoi de l'email
|
||||||
|
if (response && targetEmail) {
|
||||||
|
try {
|
||||||
|
const chorals = await strapi
|
||||||
|
.documents("api::choral.choral")
|
||||||
|
.findMany({
|
||||||
|
filters: {
|
||||||
|
id: data.choral,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const choral = chorals[0];
|
||||||
|
|
||||||
|
if (isExternalInvite) {
|
||||||
|
// Email d'invitation avec le lien tokenisé
|
||||||
|
await strapi
|
||||||
|
.service("api::mails.mails")
|
||||||
|
.sendInvitation(
|
||||||
|
targetEmail,
|
||||||
|
inviter?.username || "Un membre",
|
||||||
|
choral?.name || "votre chorale",
|
||||||
|
token,
|
||||||
|
);
|
||||||
|
} else if (isInternalInvite) {
|
||||||
|
// Email de notification pour un utilisateur existant
|
||||||
|
// Ici le token est 'null', on prévient le service que c'est un user interne
|
||||||
|
await strapi.service("api::mails.mails").sendInvitation(
|
||||||
|
targetEmail,
|
||||||
|
inviter?.username || "Un membre",
|
||||||
|
choral?.name || "votre chorale",
|
||||||
|
null, // On passe explicitement null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
"Erreur lors de l'envoi de l'email d'invitation :",
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|||||||
@@ -100,6 +100,31 @@
|
|||||||
"relation": "oneToMany",
|
"relation": "oneToMany",
|
||||||
"target": "api::channel.channel",
|
"target": "api::channel.channel",
|
||||||
"mappedBy": "choral"
|
"mappedBy": "choral"
|
||||||
|
},
|
||||||
|
"available_tags": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"social_networks": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
"founded": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"available_roles": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"logo": {
|
||||||
|
"allowedTypes": [
|
||||||
|
"images",
|
||||||
|
"files",
|
||||||
|
"videos",
|
||||||
|
"audios"
|
||||||
|
],
|
||||||
|
"type": "media",
|
||||||
|
"multiple": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,5 +33,5 @@ export default factories.createCoreController(
|
|||||||
const result = await super.create(ctx);
|
const result = await super.create(ctx);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"kind": "collectionType",
|
||||||
|
"collectionName": "form_templates",
|
||||||
|
"info": {
|
||||||
|
"singularName": "form-template",
|
||||||
|
"pluralName": "form-templates",
|
||||||
|
"displayName": "FormTemplate"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"draftAndPublish": false
|
||||||
|
},
|
||||||
|
"pluginOptions": {},
|
||||||
|
"attributes": {
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
"state": {
|
||||||
|
"type": "enumeration",
|
||||||
|
"enum": [
|
||||||
|
"draft",
|
||||||
|
"published",
|
||||||
|
"archived"
|
||||||
|
],
|
||||||
|
"default": "draft"
|
||||||
|
},
|
||||||
|
"original_file": {
|
||||||
|
"allowedTypes": [
|
||||||
|
"images",
|
||||||
|
"files",
|
||||||
|
"videos",
|
||||||
|
"audios"
|
||||||
|
],
|
||||||
|
"type": "media",
|
||||||
|
"multiple": false
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"target_tags": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"choral": {
|
||||||
|
"type": "relation",
|
||||||
|
"relation": "oneToOne",
|
||||||
|
"target": "api::choral.choral"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"type": "relation",
|
||||||
|
"relation": "oneToOne",
|
||||||
|
"target": "plugin::users-permissions.user"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/api/form-template/controllers/form-template.ts
Normal file
7
src/api/form-template/controllers/form-template.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* form-template controller
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi'
|
||||||
|
|
||||||
|
export default factories.createCoreController('api::form-template.form-template');
|
||||||
7
src/api/form-template/routes/form-template.ts
Normal file
7
src/api/form-template/routes/form-template.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* form-template router
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export default factories.createCoreRouter('api::form-template.form-template');
|
||||||
7
src/api/form-template/services/form-template.ts
Normal file
7
src/api/form-template/services/form-template.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* form-template service
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export default factories.createCoreService('api::form-template.form-template');
|
||||||
@@ -25,6 +25,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"component": "mail.mail"
|
"component": "mail.mail"
|
||||||
|
},
|
||||||
|
"onInviteUser": {
|
||||||
|
"type": "component",
|
||||||
|
"repeatable": true,
|
||||||
|
"pluginOptions": {
|
||||||
|
"i18n": {
|
||||||
|
"localized": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"component": "mail.mail"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,61 @@
|
|||||||
/**
|
import { factories } from "@strapi/strapi";
|
||||||
* mails service
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { factories } from '@strapi/strapi';
|
export default factories.createCoreService(
|
||||||
|
"api::mails.mails",
|
||||||
|
({ strapi }) => ({
|
||||||
|
// Notre méthode personnalisée
|
||||||
|
async sendInvitation(
|
||||||
|
emailAddress: string,
|
||||||
|
inviterName: string,
|
||||||
|
choirName: string,
|
||||||
|
inviteToken: string | null,
|
||||||
|
) {
|
||||||
|
// 1. Définir le lien de redirection selon le type d'utilisateur
|
||||||
|
// S'il y a un token, c'est un nouvel utilisateur. Sinon, c'est un membre existant.
|
||||||
|
const inviteLink = inviteToken
|
||||||
|
? `https://www.choralsync.com/invite?token=${inviteToken}`
|
||||||
|
: `https://www.choralsync.com/app`; // Lien vers l'app pour accepter l'invitation interne
|
||||||
|
|
||||||
export default factories.createCoreService('api::mails.mails');
|
// 2. Récupérer le single-type "mails" avec l'API Document
|
||||||
|
const mailsConfig = await strapi.documents("api::mails.mails").findFirst({
|
||||||
|
populate: ["onInviteUser"],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mailsConfig || !mailsConfig.onInviteUser) {
|
||||||
|
throw new Error(
|
||||||
|
"Le template d'email d'invitation n'est pas configuré dans le CMS.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const templateConfig = mailsConfig.onInviteUser[0];
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 3. Envoyer l'email via le moteur de template natif
|
||||||
|
await strapi.plugin("email").service("email").sendTemplatedEmail(
|
||||||
|
{
|
||||||
|
to: emailAddress,
|
||||||
|
from: "ChoralSync <contact@choralsync.com>",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
subject: templateConfig.subject,
|
||||||
|
html: templateConfig.message,
|
||||||
|
text: `Bonjour, Vous avez été invité(e) par <%= inviter_name %> à rejoindre <%= choir_name %>. Acceptez l'invitation en cliquant sur ce lien : <%= invite_link %>`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Variables injectées dans le template (<%= variable %>)
|
||||||
|
inviter_name: inviterName,
|
||||||
|
choir_name: choirName,
|
||||||
|
invite_link: inviteLink,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return { success: true };
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Erreur lors de l'envoi de l'email :", error);
|
||||||
|
// On throw l'erreur pour que le contrôleur puisse la logger,
|
||||||
|
// mais idéalement sans bloquer la création en base.
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|||||||
@@ -33,6 +33,14 @@
|
|||||||
"type": "relation",
|
"type": "relation",
|
||||||
"relation": "oneToOne",
|
"relation": "oneToOne",
|
||||||
"target": "api::choral.choral"
|
"target": "api::choral.choral"
|
||||||
|
},
|
||||||
|
"reactions": {
|
||||||
|
"type": "json"
|
||||||
|
},
|
||||||
|
"parent_message": {
|
||||||
|
"type": "relation",
|
||||||
|
"relation": "oneToOne",
|
||||||
|
"target": "api::message.message"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,134 @@
|
|||||||
|
|
||||||
import { factories } from "@strapi/strapi";
|
import { factories } from "@strapi/strapi";
|
||||||
|
|
||||||
|
interface ChannelPermissions {
|
||||||
|
[roleName: string]: {
|
||||||
|
read: boolean;
|
||||||
|
write: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PopulatedChannel {
|
||||||
|
id: any;
|
||||||
|
permissions?: any;
|
||||||
|
choral?: {
|
||||||
|
id: any;
|
||||||
|
available_roles?: any[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ChoralMembership {
|
||||||
|
id: any;
|
||||||
|
role_id?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export default factories.createCoreController(
|
export default factories.createCoreController(
|
||||||
"api::message.message",
|
"api::message.message",
|
||||||
({ strapi }) => ({
|
({ strapi }) => ({
|
||||||
async create(ctx) {
|
async create(ctx) {
|
||||||
return super.create(ctx);
|
const { channel: channelId } = ctx.request.body.data;
|
||||||
|
const user = ctx.state.user;
|
||||||
|
|
||||||
|
// 1. Récupérer les permissions du channel et son choral
|
||||||
|
const channel = (await strapi.entityService.findOne(
|
||||||
|
"api::channel.channel",
|
||||||
|
channelId,
|
||||||
|
{ populate: ["choral"] },
|
||||||
|
)) as unknown as PopulatedChannel;
|
||||||
|
|
||||||
|
if (!channel || !channel.choral) {
|
||||||
|
return ctx.badRequest("Canal ou chorale introuvable.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Récupérer le membership du user pour cette chorale
|
||||||
|
const memberships = (await strapi.entityService.findMany(
|
||||||
|
"api::choral-membership.choral-membership",
|
||||||
|
{
|
||||||
|
filters: {
|
||||||
|
user: user.id,
|
||||||
|
choral: channel.choral.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)) as unknown as ChoralMembership[];
|
||||||
|
|
||||||
|
const membership = memberships?.[0];
|
||||||
|
const userRoleId = membership?.role_id;
|
||||||
|
|
||||||
|
// Résolution du nom du rôle à partir des available_roles de la chorale
|
||||||
|
const availableRoles = channel.choral.available_roles || [];
|
||||||
|
const userRoleName = availableRoles.find(
|
||||||
|
(r) => String(r.id) === String(userRoleId),
|
||||||
|
)?.name;
|
||||||
|
|
||||||
|
// 3. Vérification "Write" (on vérifie le flag write pour le rôle spécifique)
|
||||||
|
const permissions = channel.permissions as unknown as ChannelPermissions;
|
||||||
|
const canWrite =
|
||||||
|
permissions?.[userRoleName]?.write === true ||
|
||||||
|
userRoleId === "admin" ||
|
||||||
|
userRoleName === "Admin";
|
||||||
|
|
||||||
|
if (!canWrite) {
|
||||||
|
return ctx.forbidden(
|
||||||
|
"Désolé, tu n'as pas le droit d'écrire dans ce salon.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Procéder à la création si OK
|
||||||
|
return await super.create(ctx);
|
||||||
},
|
},
|
||||||
})
|
|
||||||
|
async addReaction(ctx) {
|
||||||
|
const { id } = ctx.params;
|
||||||
|
const { reaction } = ctx.request.body;
|
||||||
|
const user = ctx.state.user;
|
||||||
|
|
||||||
|
if (!reaction) {
|
||||||
|
return ctx.badRequest("La réaction est requise.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Récupérer le message
|
||||||
|
const message = await strapi.entityService.findOne(
|
||||||
|
"api::message.message",
|
||||||
|
id
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
return ctx.notFound("Message introuvable.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Gérer les réactions (toggle logic)
|
||||||
|
let reactions = (message.reactions as any) || {};
|
||||||
|
if (typeof reactions !== "object") {
|
||||||
|
reactions = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!reactions[reaction]) {
|
||||||
|
reactions[reaction] = [user.id];
|
||||||
|
} else {
|
||||||
|
const index = reactions[reaction].indexOf(user.id);
|
||||||
|
if (index > -1) {
|
||||||
|
// Si l'utilisateur a déjà réagi, on retire sa réaction
|
||||||
|
reactions[reaction].splice(index, 1);
|
||||||
|
// Si plus personne n'a réagi avec cet emoji, on retire l'entrée
|
||||||
|
if (reactions[reaction].length === 0) {
|
||||||
|
delete reactions[reaction];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Sinon on ajoute l'utilisateur
|
||||||
|
reactions[reaction].push(user.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Mettre à jour le message
|
||||||
|
const updatedMessage = await strapi.entityService.update(
|
||||||
|
"api::message.message",
|
||||||
|
id,
|
||||||
|
{
|
||||||
|
data: { reactions },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return updatedMessage;
|
||||||
|
},
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
9
src/api/message/routes/01-custom-message.ts
Normal file
9
src/api/message/routes/01-custom-message.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
path: "/messages/:id/react",
|
||||||
|
handler: "message.addReaction",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
32
src/api/order/content-types/order/schema.json
Normal file
32
src/api/order/content-types/order/schema.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"kind": "collectionType",
|
||||||
|
"collectionName": "orders",
|
||||||
|
"info": {
|
||||||
|
"singularName": "order",
|
||||||
|
"pluralName": "orders",
|
||||||
|
"displayName": "Order",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"draftAndPublish": false
|
||||||
|
},
|
||||||
|
"pluginOptions": {},
|
||||||
|
"attributes": {
|
||||||
|
"stripeId": {
|
||||||
|
"type": "string",
|
||||||
|
"unique": true
|
||||||
|
},
|
||||||
|
"amount": {
|
||||||
|
"type": "decimal"
|
||||||
|
},
|
||||||
|
"planType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"type": "relation",
|
||||||
|
"relation": "manyToOne",
|
||||||
|
"target": "plugin::users-permissions.user",
|
||||||
|
"inversedBy": "orders"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
src/api/order/controllers/order.ts
Normal file
75
src/api/order/controllers/order.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import { factories } from "@strapi/strapi";
|
||||||
|
import Stripe from "stripe";
|
||||||
|
|
||||||
|
export default factories.createCoreController(
|
||||||
|
"api::order.order" as any,
|
||||||
|
({ strapi }) => ({
|
||||||
|
async handleWebhook(ctx) {
|
||||||
|
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
|
||||||
|
const sig = ctx.request.headers["stripe-signature"];
|
||||||
|
const unparsedBody = ctx.request.body[Symbol.for("unparsedBody")];
|
||||||
|
|
||||||
|
let event: Stripe.Event;
|
||||||
|
|
||||||
|
try {
|
||||||
|
event = stripe.webhooks.constructEvent(
|
||||||
|
unparsedBody,
|
||||||
|
sig as string,
|
||||||
|
process.env.STRIPE_WEBHOOK_SECRET!,
|
||||||
|
);
|
||||||
|
} catch (err: any) {
|
||||||
|
strapi.log.error(`❌ Erreur de signature Webhook: ${err.message}`);
|
||||||
|
return ctx.badRequest(`Webhook Error: ${err.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IMPORTANT : On logue le type d'événement reçu pour débugger
|
||||||
|
strapi.log.info(`📩 Événement reçu : ${event.type}`);
|
||||||
|
|
||||||
|
// On ne traite QUE le checkout.session.completed
|
||||||
|
if (event.type === "checkout.session.completed") {
|
||||||
|
const session = event.data.object as Stripe.Checkout.Session;
|
||||||
|
const userId = session.metadata?.userId;
|
||||||
|
const planType = session.metadata?.planType as
|
||||||
|
| "free"
|
||||||
|
| "pro"
|
||||||
|
| "premium";
|
||||||
|
|
||||||
|
if (userId) {
|
||||||
|
try {
|
||||||
|
// Création de la commande
|
||||||
|
await strapi.documents("api::order.order").create({
|
||||||
|
data: {
|
||||||
|
stripeId: session.id,
|
||||||
|
amount: session.amount_total ? session.amount_total / 100 : 0,
|
||||||
|
planType: planType,
|
||||||
|
user: userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mise à jour de l'utilisateur
|
||||||
|
await strapi.documents("plugin::users-permissions.user").update({
|
||||||
|
documentId: userId,
|
||||||
|
data: {
|
||||||
|
isPremium: true,
|
||||||
|
subscriptionPlan: planType,
|
||||||
|
stripeCustomerId: session.customer as string,
|
||||||
|
subscriptionId: session.subscription as string,
|
||||||
|
trialStartedAt: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
strapi.log.info(
|
||||||
|
`✅ Droits mis à jour pour l'utilisateur ${userId}`,
|
||||||
|
);
|
||||||
|
} catch (dbError) {
|
||||||
|
strapi.log.error(`❌ Erreur base de données : ${dbError.message}`);
|
||||||
|
// On répond quand même 200 à Stripe pour éviter les retries infinis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// INDISPENSABLE : Répondre 200 OK à Stripe pour TOUS les événements
|
||||||
|
// Cela évite que Stripe ne renvoie la requête 10 fois
|
||||||
|
ctx.send({ received: true });
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
24
src/api/order/routes/order.ts
Normal file
24
src/api/order/routes/order.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
export default {
|
||||||
|
routes: [
|
||||||
|
// La route pour le Webhook Stripe
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
path: "/stripe/webhook",
|
||||||
|
handler: "api::order.order.handleWebhook",
|
||||||
|
config: {
|
||||||
|
auth: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// Les routes automatiques (find, findOne, create, etc.)
|
||||||
|
{
|
||||||
|
method: "GET",
|
||||||
|
path: "/orders",
|
||||||
|
handler: "api::order.order.find",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: "GET",
|
||||||
|
path: "/orders/:id",
|
||||||
|
handler: "api::order.order.findOne",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
7
src/api/order/services/order.ts
Normal file
7
src/api/order/services/order.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* order service
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { factories } from '@strapi/strapi';
|
||||||
|
|
||||||
|
export default factories.createCoreService('api::order.order');
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -242,6 +242,31 @@
|
|||||||
},
|
},
|
||||||
"education": {
|
"education": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"subscriptionPlan": {
|
||||||
|
"type": "enumeration",
|
||||||
|
"enum": [
|
||||||
|
"free",
|
||||||
|
"pro",
|
||||||
|
"premium"
|
||||||
|
],
|
||||||
|
"default": "free"
|
||||||
|
},
|
||||||
|
"maxChoirs": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"trialStartedAt": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"orders": {
|
||||||
|
"type": "relation",
|
||||||
|
"relation": "oneToMany",
|
||||||
|
"target": "api::order.order",
|
||||||
|
"mappedBy": "user"
|
||||||
|
},
|
||||||
|
"smartTags": {
|
||||||
|
"type": "json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/index.ts
10
src/index.ts
@@ -1,13 +1,21 @@
|
|||||||
import type { Core } from "@strapi/strapi";
|
import type { Core } from "@strapi/strapi";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An asynchronous register function that runs before
|
* An asynchronous register function that runs before
|
||||||
* your application is initialized.
|
* your application is initialized.
|
||||||
*
|
*
|
||||||
* This gives you an opportunity to extend code.
|
* This gives you an opportunity to extend code.
|
||||||
*/
|
*/
|
||||||
register(/* { strapi }: { strapi: Core.Strapi } */) {},
|
register( { strapi }: { strapi: Core.Strapi } ) {
|
||||||
|
strapi.server.use(async (ctx, next) => {
|
||||||
|
if (ctx.req?.socket) {
|
||||||
|
(ctx.req.socket as any).encrypted = true;
|
||||||
|
}
|
||||||
|
await next();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An asynchronous bootstrap function that runs before
|
* An asynchronous bootstrap function that runs before
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"types": ["node", "react", "react-dom"]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
// Include root files
|
// Include root files
|
||||||
|
|||||||
109
types/generated/contentTypes.d.ts
vendored
109
types/generated/contentTypes.d.ts
vendored
@@ -560,6 +560,7 @@ export interface ApiBoardBoard extends Struct.CollectionTypeSchema {
|
|||||||
export interface ApiChannelChannel extends Struct.CollectionTypeSchema {
|
export interface ApiChannelChannel extends Struct.CollectionTypeSchema {
|
||||||
collectionName: 'channels';
|
collectionName: 'channels';
|
||||||
info: {
|
info: {
|
||||||
|
description: '';
|
||||||
displayName: 'Channel';
|
displayName: 'Channel';
|
||||||
pluralName: 'channels';
|
pluralName: 'channels';
|
||||||
singularName: 'channel';
|
singularName: 'channel';
|
||||||
@@ -572,6 +573,7 @@ export interface ApiChannelChannel extends Struct.CollectionTypeSchema {
|
|||||||
createdAt: Schema.Attribute.DateTime;
|
createdAt: Schema.Attribute.DateTime;
|
||||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
description: Schema.Attribute.Text;
|
||||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
localizations: Schema.Attribute.Relation<
|
localizations: Schema.Attribute.Relation<
|
||||||
'oneToMany',
|
'oneToMany',
|
||||||
@@ -580,6 +582,7 @@ export interface ApiChannelChannel extends Struct.CollectionTypeSchema {
|
|||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
messages: Schema.Attribute.Relation<'oneToMany', 'api::message.message'>;
|
messages: Schema.Attribute.Relation<'oneToMany', 'api::message.message'>;
|
||||||
name: Schema.Attribute.String;
|
name: Schema.Attribute.String;
|
||||||
|
permissions: Schema.Attribute.JSON;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
type: Schema.Attribute.Enumeration<['TEXT', 'AUDIO', 'VIDEO']>;
|
type: Schema.Attribute.Enumeration<['TEXT', 'AUDIO', 'VIDEO']>;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
@@ -723,15 +726,22 @@ export interface ApiChoralMembershipChoralMembership
|
|||||||
createdAt: Schema.Attribute.DateTime;
|
createdAt: Schema.Attribute.DateTime;
|
||||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
invite_email: Schema.Attribute.Email & Schema.Attribute.Private;
|
||||||
|
invite_token: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
localizations: Schema.Attribute.Relation<
|
localizations: Schema.Attribute.Relation<
|
||||||
'oneToMany',
|
'oneToMany',
|
||||||
'api::choral-membership.choral-membership'
|
'api::choral-membership.choral-membership'
|
||||||
> &
|
> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
permission_exceptions: Schema.Attribute.JSON;
|
||||||
permissions: Schema.Attribute.Component<'user.permissions', true>;
|
permissions: Schema.Attribute.Component<'user.permissions', true>;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
role: Schema.Attribute.Enumeration<['member', 'admin', 'owner']>;
|
role: Schema.Attribute.Enumeration<['member', 'admin', 'owner']>;
|
||||||
|
role_id: Schema.Attribute.String;
|
||||||
|
state: Schema.Attribute.Enumeration<
|
||||||
|
['active', 'pending_user_approval', 'pending_admin_approval', 'decline']
|
||||||
|
>;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
@@ -799,6 +809,8 @@ export interface ApiChoralChoral extends Struct.CollectionTypeSchema {
|
|||||||
'oneToMany',
|
'oneToMany',
|
||||||
'api::announcement.announcement'
|
'api::announcement.announcement'
|
||||||
>;
|
>;
|
||||||
|
available_roles: Schema.Attribute.JSON;
|
||||||
|
available_tags: Schema.Attribute.JSON;
|
||||||
boards: Schema.Attribute.Relation<'oneToMany', 'api::board.board'>;
|
boards: Schema.Attribute.Relation<'oneToMany', 'api::board.board'>;
|
||||||
calendar: Schema.Attribute.Relation<'oneToMany', 'api::event.event'>;
|
calendar: Schema.Attribute.Relation<'oneToMany', 'api::event.event'>;
|
||||||
channels: Schema.Attribute.Relation<'oneToMany', 'api::channel.channel'>;
|
channels: Schema.Attribute.Relation<'oneToMany', 'api::channel.channel'>;
|
||||||
@@ -808,13 +820,16 @@ export interface ApiChoralChoral extends Struct.CollectionTypeSchema {
|
|||||||
createdAt: Schema.Attribute.DateTime;
|
createdAt: Schema.Attribute.DateTime;
|
||||||
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
description: Schema.Attribute.Text;
|
||||||
email: Schema.Attribute.Email;
|
email: Schema.Attribute.Email;
|
||||||
|
founded: Schema.Attribute.Integer;
|
||||||
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
localizations: Schema.Attribute.Relation<
|
localizations: Schema.Attribute.Relation<
|
||||||
'oneToMany',
|
'oneToMany',
|
||||||
'api::choral.choral'
|
'api::choral.choral'
|
||||||
> &
|
> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
logo: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
|
||||||
memberships: Schema.Attribute.Relation<
|
memberships: Schema.Attribute.Relation<
|
||||||
'oneToMany',
|
'oneToMany',
|
||||||
'api::choral-membership.choral-membership'
|
'api::choral-membership.choral-membership'
|
||||||
@@ -831,6 +846,7 @@ export interface ApiChoralChoral extends Struct.CollectionTypeSchema {
|
|||||||
phoneNumber: Schema.Attribute.String;
|
phoneNumber: Schema.Attribute.String;
|
||||||
postal: Schema.Attribute.Integer;
|
postal: Schema.Attribute.Integer;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
|
social_networks: Schema.Attribute.JSON;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
@@ -1144,6 +1160,48 @@ export interface ApiEventEvent extends Struct.CollectionTypeSchema {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ApiFormTemplateFormTemplate
|
||||||
|
extends Struct.CollectionTypeSchema {
|
||||||
|
collectionName: 'form_templates';
|
||||||
|
info: {
|
||||||
|
displayName: 'FormTemplate';
|
||||||
|
pluralName: 'form-templates';
|
||||||
|
singularName: 'form-template';
|
||||||
|
};
|
||||||
|
options: {
|
||||||
|
draftAndPublish: false;
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
author: Schema.Attribute.Relation<
|
||||||
|
'oneToOne',
|
||||||
|
'plugin::users-permissions.user'
|
||||||
|
>;
|
||||||
|
choral: Schema.Attribute.Relation<'oneToOne', 'api::choral.choral'>;
|
||||||
|
createdAt: Schema.Attribute.DateTime;
|
||||||
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
description: Schema.Attribute.Text;
|
||||||
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
|
localizations: Schema.Attribute.Relation<
|
||||||
|
'oneToMany',
|
||||||
|
'api::form-template.form-template'
|
||||||
|
> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
original_file: Schema.Attribute.Media<
|
||||||
|
'images' | 'files' | 'videos' | 'audios'
|
||||||
|
>;
|
||||||
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
|
schema: Schema.Attribute.JSON;
|
||||||
|
state: Schema.Attribute.Enumeration<['draft', 'published', 'archived']> &
|
||||||
|
Schema.Attribute.DefaultTo<'draft'>;
|
||||||
|
target_tags: Schema.Attribute.JSON;
|
||||||
|
title: Schema.Attribute.String & Schema.Attribute.Required;
|
||||||
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface ApiGroupMembershipGroupMembership
|
export interface ApiGroupMembershipGroupMembership
|
||||||
extends Struct.CollectionTypeSchema {
|
extends Struct.CollectionTypeSchema {
|
||||||
collectionName: 'group_memberships';
|
collectionName: 'group_memberships';
|
||||||
@@ -1316,6 +1374,12 @@ export interface ApiMailsMails extends Struct.SingleTypeSchema {
|
|||||||
localized: true;
|
localized: true;
|
||||||
};
|
};
|
||||||
}>;
|
}>;
|
||||||
|
onInviteUser: Schema.Attribute.Component<'mail.mail', true> &
|
||||||
|
Schema.Attribute.SetPluginOptions<{
|
||||||
|
i18n: {
|
||||||
|
localized: true;
|
||||||
|
};
|
||||||
|
}>;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
@@ -1352,7 +1416,12 @@ export interface ApiMessageMessage extends Struct.CollectionTypeSchema {
|
|||||||
'api::message.message'
|
'api::message.message'
|
||||||
> &
|
> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
parent_message: Schema.Attribute.Relation<
|
||||||
|
'oneToOne',
|
||||||
|
'api::message.message'
|
||||||
|
>;
|
||||||
publishedAt: Schema.Attribute.DateTime;
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
|
reactions: Schema.Attribute.JSON;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
@@ -1400,6 +1469,38 @@ export interface ApiNotificationNotification
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ApiOrderOrder extends Struct.CollectionTypeSchema {
|
||||||
|
collectionName: 'orders';
|
||||||
|
info: {
|
||||||
|
description: '';
|
||||||
|
displayName: 'Order';
|
||||||
|
pluralName: 'orders';
|
||||||
|
singularName: 'order';
|
||||||
|
};
|
||||||
|
options: {
|
||||||
|
draftAndPublish: false;
|
||||||
|
};
|
||||||
|
attributes: {
|
||||||
|
amount: Schema.Attribute.Decimal;
|
||||||
|
createdAt: Schema.Attribute.DateTime;
|
||||||
|
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
locale: Schema.Attribute.String & Schema.Attribute.Private;
|
||||||
|
localizations: Schema.Attribute.Relation<'oneToMany', 'api::order.order'> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
planType: Schema.Attribute.String;
|
||||||
|
publishedAt: Schema.Attribute.DateTime;
|
||||||
|
stripeId: Schema.Attribute.String & Schema.Attribute.Unique;
|
||||||
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
|
Schema.Attribute.Private;
|
||||||
|
user: Schema.Attribute.Relation<
|
||||||
|
'manyToOne',
|
||||||
|
'plugin::users-permissions.user'
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface ApiPagePage extends Struct.CollectionTypeSchema {
|
export interface ApiPagePage extends Struct.CollectionTypeSchema {
|
||||||
collectionName: 'pages';
|
collectionName: 'pages';
|
||||||
info: {
|
info: {
|
||||||
@@ -2113,7 +2214,9 @@ export interface PluginUsersPermissionsUser
|
|||||||
'plugin::users-permissions.user'
|
'plugin::users-permissions.user'
|
||||||
> &
|
> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
|
maxChoirs: Schema.Attribute.Integer & Schema.Attribute.DefaultTo<0>;
|
||||||
name: Schema.Attribute.String;
|
name: Schema.Attribute.String;
|
||||||
|
orders: Schema.Attribute.Relation<'oneToMany', 'api::order.order'>;
|
||||||
parameter: Schema.Attribute.Component<'configuration.parameter', false>;
|
parameter: Schema.Attribute.Component<'configuration.parameter', false>;
|
||||||
password: Schema.Attribute.Password &
|
password: Schema.Attribute.Password &
|
||||||
Schema.Attribute.Private &
|
Schema.Attribute.Private &
|
||||||
@@ -2138,8 +2241,12 @@ export interface PluginUsersPermissionsUser
|
|||||||
'plugin::users-permissions.role'
|
'plugin::users-permissions.role'
|
||||||
>;
|
>;
|
||||||
saved_posts: Schema.Attribute.Relation<'oneToMany', 'api::post.post'>;
|
saved_posts: Schema.Attribute.Relation<'oneToMany', 'api::post.post'>;
|
||||||
|
smartTags: Schema.Attribute.JSON;
|
||||||
|
subscriptionPlan: Schema.Attribute.Enumeration<['free', 'pro', 'premium']> &
|
||||||
|
Schema.Attribute.DefaultTo<'free'>;
|
||||||
surname: Schema.Attribute.String;
|
surname: Schema.Attribute.String;
|
||||||
tags: Schema.Attribute.JSON;
|
tags: Schema.Attribute.JSON;
|
||||||
|
trialStartedAt: Schema.Attribute.Date;
|
||||||
updatedAt: Schema.Attribute.DateTime;
|
updatedAt: Schema.Attribute.DateTime;
|
||||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||||
Schema.Attribute.Private;
|
Schema.Attribute.Private;
|
||||||
@@ -2194,6 +2301,7 @@ declare module '@strapi/strapi' {
|
|||||||
'api::direct-message.direct-message': ApiDirectMessageDirectMessage;
|
'api::direct-message.direct-message': ApiDirectMessageDirectMessage;
|
||||||
'api::event-relationship.event-relationship': ApiEventRelationshipEventRelationship;
|
'api::event-relationship.event-relationship': ApiEventRelationshipEventRelationship;
|
||||||
'api::event.event': ApiEventEvent;
|
'api::event.event': ApiEventEvent;
|
||||||
|
'api::form-template.form-template': ApiFormTemplateFormTemplate;
|
||||||
'api::group-membership.group-membership': ApiGroupMembershipGroupMembership;
|
'api::group-membership.group-membership': ApiGroupMembershipGroupMembership;
|
||||||
'api::group.group': ApiGroupGroup;
|
'api::group.group': ApiGroupGroup;
|
||||||
'api::invite.invite': ApiInviteInvite;
|
'api::invite.invite': ApiInviteInvite;
|
||||||
@@ -2201,6 +2309,7 @@ declare module '@strapi/strapi' {
|
|||||||
'api::mails.mails': ApiMailsMails;
|
'api::mails.mails': ApiMailsMails;
|
||||||
'api::message.message': ApiMessageMessage;
|
'api::message.message': ApiMessageMessage;
|
||||||
'api::notification.notification': ApiNotificationNotification;
|
'api::notification.notification': ApiNotificationNotification;
|
||||||
|
'api::order.order': ApiOrderOrder;
|
||||||
'api::page.page': ApiPagePage;
|
'api::page.page': ApiPagePage;
|
||||||
'api::permissions-template.permissions-template': ApiPermissionsTemplatePermissionsTemplate;
|
'api::permissions-template.permissions-template': ApiPermissionsTemplatePermissionsTemplate;
|
||||||
'api::post-ownership.post-ownership': ApiPostOwnershipPostOwnership;
|
'api::post-ownership.post-ownership': ApiPostOwnershipPostOwnership;
|
||||||
|
|||||||
Reference in New Issue
Block a user