From 6fee998065567637c93e470b42c6cb60ba999c6d Mon Sep 17 00:00:00 2001 From: VikDavydiuk <117301540+VikDavydiuk@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:01:21 +0200 Subject: [PATCH] BC-4992-Upload school logo (#4425) * BC-4992-Upload school logo * Delete logo_nam --------- Co-authored-by: Viktoriia <1> --- apps/server/src/modules/management/seed-data/schools.ts | 4 ++++ backup/setup/schools.json | 2 ++ src/services/school/hooks/index.js | 2 +- src/services/school/model.js | 1 + test/services/helpers/services/schools.js | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/server/src/modules/management/seed-data/schools.ts b/apps/server/src/modules/management/seed-data/schools.ts index a4d9e538594..ba09c0d6952 100644 --- a/apps/server/src/modules/management/seed-data/schools.ts +++ b/apps/server/src/modules/management/seed-data/schools.ts @@ -34,6 +34,7 @@ type SeedSchoolProperties = Omit timezone?: string; language?: string; logo_dataUrl?: string; + logo_name?: string; enableStudentTeamCreation?: boolean; }; @@ -180,6 +181,7 @@ const seedSchools: SeedSchoolProperties[] = [ pilot: false, language: 'de', logo_dataUrl: '', + logo_name: '', officialSchoolNumber: '', }, { @@ -204,6 +206,7 @@ const seedSchools: SeedSchoolProperties[] = [ timezone: 'America/Belem', language: 'en', logo_dataUrl: '', + logo_name: '', officialSchoolNumber: '', }, { @@ -311,6 +314,7 @@ export function generateSchools(entities: { schoolEntity['timezone'] = partial.timezone; schoolEntity['language'] = partial.language; schoolEntity['logo_dataUrl'] = partial.logo_dataUrl; + schoolEntity['logo_name'] = partial.logo_name; schoolEntity['enableStudentTeamCreation'] = partial.enableStudentTeamCreation; return schoolEntity; diff --git a/backup/setup/schools.json b/backup/setup/schools.json index 9078df81bfb..ecbfd82b4c6 100644 --- a/backup/setup/schools.json +++ b/backup/setup/schools.json @@ -230,6 +230,7 @@ }, "language": "de", "logo_dataUrl": "", + "logo_name": "", "officialSchoolNumber": "" }, { @@ -271,6 +272,7 @@ }, "language": "en", "logo_dataUrl": "", + "logo_name": "", "officialSchoolNumber": "" }, { diff --git a/src/services/school/hooks/index.js b/src/services/school/hooks/index.js index 98024706fa0..d2904cf33c4 100644 --- a/src/services/school/hooks/index.js +++ b/src/services/school/hooks/index.js @@ -172,7 +172,7 @@ const hasEditPermissions = async (context) => { if ( (user.permissions.includes('SCHOOL_CHAT_MANAGE') && updatesChat(key, context.data)) || (user.permissions.includes('SCHOOL_STUDENT_TEAM_MANAGE') && updatesTeamCreation(key, context.data)) || - (user.permissions.includes('SCHOOL_LOGO_MANAGE') && key === 'logo_dataUrl') + (user.permissions.includes('SCHOOL_LOGO_MANAGE') && (key === 'logo_dataUrl' || key === 'logo_name')) ) { patch[key] = context.data[key]; } diff --git a/src/services/school/model.js b/src/services/school/model.js index 51f886baea2..0ec931e4191 100644 --- a/src/services/school/model.js +++ b/src/services/school/model.js @@ -77,6 +77,7 @@ const schoolSchema = new Schema( currentYear: { type: Schema.Types.ObjectId, ref: 'year' }, customYears: [{ type: customYearSchema }], logo_dataUrl: { type: String }, + logo_name: { type: String }, purpose: { type: String }, rssFeeds: [{ type: rssFeedSchema }], language: { type: String }, diff --git a/test/services/helpers/services/schools.js b/test/services/helpers/services/schools.js index d44753f6821..cabd6055947 100644 --- a/test/services/helpers/services/schools.js +++ b/test/services/helpers/services/schools.js @@ -22,6 +22,7 @@ const create = documentBaseDirType, // eslint-disable-next-line camelcase logo_dataUrl, + logo_name, purpose = 'test', rssFeeds = [], features = [], @@ -56,6 +57,7 @@ const create = currentYear, // eslint-disable-next-line camelcase logo_dataUrl, + logo_name, purpose, rssFeeds, features,