Files
cms/config/plugins.ts
Michael Czechowski f0855a07e7
All checks were successful
Build and publish / build (pull_request) Successful in 4m38s
feat(cms): white-label email templates and API doc config
Replace all hardcoded muellerprints brand identity in email templates
with template variables (shopName, shopContactName, shopAddress,
shopPhone, shopEmail, shopLogoUrl, shopSecondaryLogoUrl) sourced from
env vars SHOP_NAME, SHOP_CONTACT_NAME, SHOP_ADDRESS, SHOP_PHONE,
SHOP_EMAIL, SHOP_LOGO_URL, SHOP_SECONDARY_LOGO_URL.

API documentation title/description now driven by API_TITLE and
API_DESCRIPTION env vars.

Closes #1
2026-04-29 20:01:30 +02:00

746 lines
22 KiB
TypeScript

export default ({ env }) => ({
upload: {
config: {
sizeLimit: 50 * 1024 * 1024
}
},
documentation: {
enabled: false,
config: {
openapi: "3.0.1",
info: {
version: "1.0.0",
title: env("API_TITLE", "Paperwork API"),
description: env("API_DESCRIPTION", "Paperwork API"),
termsOfService: false,
contact: false,
license: false,
externalDocs: false
},
"x-strapi-config": {
plugins: [],
path: "/documentation",
mutateDocumentation: (draft: any) => {
// Order endpoints - maintain existing modifications
// draft.paths["/orders/{uuid}/cart"].get.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/cart"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/generate-delivery-note"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/generate-invoice"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/add-product/{productId}"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/remove-product/{productId}"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/checkout"].post.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/send-invoice"].put.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}/send-delivery-note"].put.parameters[0].schema.type = "string";
//
// // Order request body modifications - maintain existing
// delete draft.paths["/orders/{uuid}/cart"].put.requestBody;
// delete draft.paths["/orders/{uuid}/add-product/{productId}"].put.requestBody;
// delete draft.paths["/orders/{uuid}/remove-product/{productId}"].put.requestBody;
// delete draft.paths["/orders/{uuid}/checkout"].post.requestBody;
//
// // Product publish endpoint - existing documentation
// draft.paths["/products/publish"].post.description = "Publish or unpublish products by filter";
// draft.paths["/products/publish"].post.requestBody = {
// required: true,
// content: {
// "application/json": {
// schema: {
// type: "object",
// required: ["filters"],
// properties: {
// filters: {
// type: "object",
// description: "Filters to select products (supports pattern, cover, ruling, pages)"
// },
// publish: {
// type: "boolean",
// description: "Whether to publish (true) or unpublish (false)",
// default: true
// },
// dryRun: {
// type: "boolean",
// description: "If true, no changes will be made but count will be returned",
// default: false
// }
// }
// }
// }
// }
// };
//
// draft.paths["/products/publish"].post.responses = {
// "200": {
// description: "Successfully published/unpublished products",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// published: {
// type: "integer",
// description: "Number of products published/unpublished"
// },
// dryRun: {
// type: "boolean",
// description: "Whether this was a dry run"
// }
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// error: {
// type: "string",
// description: "Error message"
// }
// }
// }
// }
// }
// }
// };
// // Product allVariants endpoint
// if (draft.paths["/products/{id}/variants/all"]) {
// draft.paths["/products/{id}/variants/all"].get.description = "Get all variants for a product";
// draft.paths["/products/{id}/variants/all"].get.responses = {
// "200": {
// description: "Returns all variants of the product",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Product"
// }
// }
// }
// }
// },
// "404": {
// description: "Product not found",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// error: {
// type: "string",
// description: "Error message"
// }
// }
// }
// }
// }
// }
// };
// }
//
// // Product variantsByPattern endpoint
// if (draft.paths["/products/{id}/variants/pattern"]) {
// draft.paths["/products/{id}/variants/pattern"].get.description = "Get product variants grouped by pattern";
// draft.paths["/products/{id}/variants/pattern"].get.responses = {
// "200": {
// description: "Returns product variants grouped by pattern",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// allProductPattern: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductPattern"
// }
// },
// productVariants: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Product"
// }
// },
// patterns: {
// type: "array",
// items: {
// type: "object",
// properties: {
// id: {
// type: "string"
// },
// name: {
// type: "string"
// },
// description: {
// type: "string"
// },
// productVariant: {
// oneOf: [
// {
// $ref: "#/components/schemas/Product"
// },
// {
// type: "null"
// }
// ]
// }
// }
// }
// }
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// error: {
// type: "string",
// description: "Error message"
// }
// }
// }
// }
// }
// }
// };
// }
//
// // Product variants endpoint
// if (draft.paths["/products/{id}/variants"]) {
// draft.paths["/products/{id}/variants"].get.description = "Get product variants grouped by pages, cover, and ruling";
// draft.paths["/products/{id}/variants"].get.responses = {
// "200": {
// description: "Returns product variants grouped by pages, cover, and ruling",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// pages: {
// type: "array",
// items: {
// type: "object",
// properties: {
// id: {
// type: "string"
// },
// name: {
// type: "string"
// },
// productVariant: {
// oneOf: [
// {
// $ref: "#/components/schemas/Product"
// },
// {
// type: "null"
// }
// ]
// }
// }
// }
// },
// cover: {
// type: "array",
// items: {
// type: "object",
// properties: {
// id: {
// type: "string"
// },
// name: {
// type: "string"
// },
// binding: {
// type: "string"
// },
// price: {
// type: "number"
// },
// productVariant: {
// oneOf: [
// {
// $ref: "#/components/schemas/Product"
// },
// {
// type: "null"
// }
// ]
// }
// }
// }
// },
// ruling: {
// type: "array",
// items: {
// type: "object",
// properties: {
// id: {
// type: "string"
// },
// name: {
// type: "string"
// },
// productVariant: {
// oneOf: [
// {
// $ref: "#/components/schemas/Product"
// },
// {
// type: "null"
// }
// ]
// }
// }
// }
// }
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// error: {
// type: "string",
// description: "Error message"
// }
// }
// }
// }
// }
// }
// };
// }
//
// // Product Category endpoints
// if (draft.paths["/product-category"]) {
// draft.paths["/product-category"].get.description = "Get all product categories";
// draft.paths["/product-category"].get.responses = {
// "200": {
// description: "Returns all product categories",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
//
// if (draft.paths["/product-category/corrupt"]) {
// draft.paths["/product-category/corrupt"].get.description = "Get all corrupted product categories";
// draft.paths["/product-category/corrupt"].get.responses = {
// "200": {
// description: "Returns all corrupted product categories",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
//
// if (draft.paths["/product-category/{id}"]) {
// draft.paths["/product-category/{id}"].get.description = "Get a single product category";
// draft.paths["/product-category/{id}"].get.responses = {
// "200": {
// description: "Returns a single product category",
// content: {
// "application/json": {
// schema: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
//
// draft.paths["/product-category/{id}"].put.description = "Update a product category";
// draft.paths["/product-category/{id}"].put.requestBody = {
// required: true,
// content: {
// "application/json": {
// schema: {
// type: "object",
// description: "The data to update the category with"
// }
// }
// }
// };
// draft.paths["/product-category/{id}"].put.responses = {
// "200": {
// description: "Returns the updated product category",
// content: {
// "application/json": {
// schema: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
//
// // Update endpoint to match the actual route from product-category.ts
// if (draft.paths["/product-category/bulk"]) {
// draft.paths["/product-category/bulk"].put.description = "Update multiple product categories";
// draft.paths["/product-category/bulk"].put.requestBody = {
// required: true,
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// categories: {
// type: "array",
// description: "Array of categories to update"
// }
// }
// }
// }
// }
// };
// draft.paths["/product-category/bulk"].put.responses = {
// "200": {
// description: "Returns the updated product categories",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
// // Remove the incorrect "/product-category/update" documentation since it doesn't exist in routes
//
// if (draft.paths["/product-category/fix"]) {
// draft.paths["/product-category/fix"].put.description = "Fix categories with missing cover or pattern";
// draft.paths["/product-category/fix"].put.responses = {
// "200": {
// description: "Returns information about fixed and failed categories",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// fixed: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductCategory"
// }
// },
// failed: {
// type: "array",
// items: {
// $ref: "#/components/schemas/ProductCategory"
// }
// }
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
//
// if (draft.paths["/product-category/fix-images"]) {
// draft.paths["/product-category/fix-images"].put.description = "Fix product images in categories";
// draft.paths["/product-category/fix-images"].put.responses = {
// "200": {
// description: "Returns information about fixed and failed product images",
// content: {
// "application/json": {
// schema: {
// type: "object",
// properties: {
// fixed: {
// type: "array",
// items: {
// type: "object",
// properties: {
// categoryId: {
// type: "string"
// },
// productCount: {
// type: "integer"
// },
// products: {
// type: "array",
// items: {
// type: "string"
// }
// }
// }
// }
// },
// failed: {
// type: "array",
// items: {
// type: "object",
// properties: {
// categoryId: {
// type: "string"
// },
// reason: {
// type: "string"
// },
// error: {
// type: "string"
// }
// }
// }
// }
// }
// }
// }
// }
// },
// "400": {
// description: "Bad request"
// }
// };
// }
//
// // Content controller endpoints
// if (draft.paths["/content"]) {
// draft.paths["/content"].get.description = "Get all content entries";
// draft.paths["/content"].get.responses = {
// "200": {
// description: "Returns all content entries",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Content"
// }
// }
// }
// }
// }
// };
// }
//
// // Customer controller endpoints
// if (draft.paths["/customers"]) {
// draft.paths["/customers"].get.description = "Get all customers";
// draft.paths["/customers"].get.responses = {
// "200": {
// description: "Returns all customers",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Customer"
// }
// }
// }
// }
// }
// };
// }
//
// // Legal controller endpoints
// if (draft.paths["/legal"]) {
// draft.paths["/legal"].get.description = "Get all legal documents";
// draft.paths["/legal"].get.responses = {
// "200": {
// description: "Returns all legal documents",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Legal"
// }
// }
// }
// }
// }
// };
// }
//
// // Delivery controller endpoints
// if (draft.paths["/deliveries"]) {
// draft.paths["/deliveries"].get.description = "Get all deliveries";
// draft.paths["/deliveries"].get.responses = {
// "200": {
// description: "Returns all deliveries",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Delivery"
// }
// }
// }
// }
// }
// };
// }
//
// // Payment controller endpoints
// if (draft.paths["/payments"]) {
// draft.paths["/payments"].get.description = "Get all payments";
// draft.paths["/payments"].get.responses = {
// "200": {
// description: "Returns all payments",
// content: {
// "application/json": {
// schema: {
// type: "array",
// items: {
// $ref: "#/components/schemas/Payment"
// }
// }
// }
// }
// }
// };
// }
//
// if (draft.paths["/orders/{uuid}"]) {
// draft.paths["/orders/{uuid}"].get.description = "Get order by UUID";
// draft.paths["/orders/{uuid}"].get.parameters[0].schema.type = "string";
// draft.paths["/orders/{uuid}"].get.responses = {
// "200": {
// description: "Returns order details",
// content: {
// "application/json": {
// schema: {
// $ref: "#/components/schemas/Order"
// }
// }
// }
// },
// "404": {
// description: "Order not found"
// }
// };
// }
//
// if (draft.paths["/orders/webhook"]) {
// draft.paths["/orders/webhook"].post.description = "Handle PayPal webhook events";
// draft.paths["/orders/webhook"].post.requestBody = {
// required: true,
// content: {
// "application/json": {
// schema: {
// type: "object",
// description: "PayPal webhook event payload"
// }
// }
// }
// };
// draft.paths["/orders/webhook"].post.responses = {
// "200": {
// description: "Webhook processed successfully"
// },
// "500": {
// description: "Internal server error"
// }
// };
// }
}
},
servers: [
{
url: "/api",
description: "API server"
}
],
security: [
{
bearerAuth: []
}
]
}
},
"strapi-prometheus": {
enabled: false,
config: {
// add prefix to all the prometheus metrics names.
prefix: "cms",
// use full url instead of matched url
// true => path label: `/api/models/1`
// false => path label: `/api/models/:id`
fullURL: false,
// include url query in the url label
// true => path label: `/api/models?limit=1`
// false => path label: `/api/models`
includeQuery: false,
// metrics that will be enabled, by default they are all enabled.
enabledMetrics: {
koa: true, // koa metrics
process: true, // metrics regarding the running process
http: true, // http metrics like response time and size
apollo: false // metrics regarding graphql
},
// interval at which rate metrics are collected in ms
interval: 30_000,
// set custom/default labels to all the prometheus metrics
customLabels: {
name: "strapi-prometheus"
}
}
}
});