mirror of
https://github.com/strapi/strapi.git
synced 2025-07-27 10:56:36 +00:00
28 lines
724 B
JavaScript
28 lines
724 B
JavaScript
'use strict';
|
|
|
|
const { yup, validateYupSchemaSync } = require('@strapi/utils');
|
|
|
|
const MAX_LOGO_SIZE = 1024 * 1024; // 1Mo
|
|
const ALLOWED_LOGO_FILE_TYPES = ['image/jpeg', 'image/png', 'image/svg+xml'];
|
|
|
|
const updateProjectSettings = yup
|
|
.object({
|
|
menuLogo: yup.string(),
|
|
})
|
|
.noUnknown();
|
|
|
|
const updateProjectSettingsFiles = yup
|
|
.object({
|
|
menuLogo: yup.object({
|
|
name: yup.string(),
|
|
type: yup.string().oneOf(ALLOWED_LOGO_FILE_TYPES),
|
|
size: yup.number().max(MAX_LOGO_SIZE),
|
|
}),
|
|
})
|
|
.noUnknown();
|
|
|
|
module.exports = {
|
|
validateUpdateProjectSettings: validateYupSchemaSync(updateProjectSettings),
|
|
validateUpdateProjectSettingsFiles: validateYupSchemaSync(updateProjectSettingsFiles),
|
|
};
|