diff --git a/backend/src/db/categories.ts b/backend/src/db/categories.ts index 24421a400..8c8943bd4 100644 --- a/backend/src/db/categories.ts +++ b/backend/src/db/categories.ts @@ -12,10 +12,21 @@ const createCategories = async () => { query: 'MATCH (category:Category) RETURN category { .* }', }) - const existingCategories = result.records.map((r) => r.get('category')) - const existingCategoryIds = existingCategories.map((c) => c.id) + const categoryIds = categories.map((c) => c.id) + const categorySlugs = categories.map((c) => c.slug) + await write({ + query: `MATCH (category:Category) + WHERE NOT category.id IN $categoryIds + DETACH DELETE category`, + variables: { + categoryIds, + categorySlugs, + }, + }) - const newCategories = categories.filter((c) => !existingCategoryIds.includes(c.id)) + const existingCategories = result.records.map((r) => r.get('category')) + + const newCategories = categories.filter((c) => !existingCategories.some((cat) => c.id === cat.id)) await write({ query: `UNWIND $newCategories AS map @@ -27,15 +38,6 @@ const createCategories = async () => { }, }) - const categoryIds = categories.map((c) => c.id) - await write({ - query: `MATCH (category:Category) - WHERE NOT category.id IN $categoryIds - DETACH DELETE category`, - variables: { - categoryIds, - }, - }) // eslint-disable-next-line no-console console.log('Successfully created categories!') await driver.close() diff --git a/backend/src/db/seed.ts b/backend/src/db/seed.ts index ed1fff1a4..e7f5b23c5 100644 --- a/backend/src/db/seed.ts +++ b/backend/src/db/seed.ts @@ -308,12 +308,11 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] await dagobert.relateTo(louie, 'blocked') // categories - let i = 0 for (const category of categories) { await Factory.build('category', { - id: `cat${i++}`, - slug: category.name, - naem: category.name, + id: category.id, + slug: category.slug, + name: category.name, icon: category.icon, }) } diff --git a/webapp/assets/_new/icons/svgs/reformer-basic-rights.svg b/webapp/assets/_new/icons/svgs/reformer-basic-rights.svg deleted file mode 100644 index 305e367ac..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-basic-rights.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -book - - diff --git a/webapp/assets/_new/icons/svgs/reformer-child-protection.svg b/webapp/assets/_new/icons/svgs/reformer-child-protection.svg deleted file mode 100644 index fcb5651f0..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-child-protection.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -child - - diff --git a/webapp/assets/_new/icons/svgs/reformer-corona.svg b/webapp/assets/_new/icons/svgs/reformer-corona.svg deleted file mode 100755 index bddbcebcc..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-corona.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -sun-o - - diff --git a/webapp/assets/_new/icons/svgs/reformer-demonstrations.svg b/webapp/assets/_new/icons/svgs/reformer-demonstrations.svg deleted file mode 100755 index 95e0d21d3..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-demonstrations.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -bullhorn - - diff --git a/webapp/assets/_new/icons/svgs/reformer-digital-euro.svg b/webapp/assets/_new/icons/svgs/reformer-digital-euro.svg deleted file mode 100755 index cddb5775a..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-digital-euro.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -university - - diff --git a/webapp/assets/_new/icons/svgs/reformer-education.svg b/webapp/assets/_new/icons/svgs/reformer-education.svg deleted file mode 100755 index 5d35226d3..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-education.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -graduation-cap - - diff --git a/webapp/assets/_new/icons/svgs/reformer-justice.svg b/webapp/assets/_new/icons/svgs/reformer-justice.svg deleted file mode 100755 index f5e446fd2..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-justice.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -balance-scale - - diff --git a/webapp/assets/_new/icons/svgs/reformer-media.svg b/webapp/assets/_new/icons/svgs/reformer-media.svg deleted file mode 100755 index 7572021ba..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-media.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -users - - diff --git a/webapp/assets/_new/icons/svgs/reformer-miscellaneous.svg b/webapp/assets/_new/icons/svgs/reformer-miscellaneous.svg deleted file mode 100644 index 07f8dbe3f..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-miscellaneous.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/webapp/assets/_new/icons/svgs/reformer-monetary-system.svg b/webapp/assets/_new/icons/svgs/reformer-monetary-system.svg deleted file mode 100755 index 04a116d2a..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-monetary-system.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -money - - diff --git a/webapp/assets/_new/icons/svgs/reformer-ngos.svg b/webapp/assets/_new/icons/svgs/reformer-ngos.svg deleted file mode 100755 index 9d390e126..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-ngos.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -chain - - diff --git a/webapp/assets/_new/icons/svgs/reformer-surveillance.svg b/webapp/assets/_new/icons/svgs/reformer-surveillance.svg deleted file mode 100755 index 793620544..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-surveillance.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -camera - - diff --git a/webapp/assets/_new/icons/svgs/reformer-transhumanism.svg b/webapp/assets/_new/icons/svgs/reformer-transhumanism.svg deleted file mode 100755 index e1ca6bde6..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-transhumanism.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -flask - - diff --git a/webapp/assets/_new/icons/svgs/reformer-who.svg b/webapp/assets/_new/icons/svgs/reformer-who.svg deleted file mode 100755 index 91bf9bf2b..000000000 --- a/webapp/assets/_new/icons/svgs/reformer-who.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -globe - -