diff --git a/backend/package.json b/backend/package.json index ac5ebb48..7e4b4eae 100644 --- a/backend/package.json +++ b/backend/package.json @@ -27,7 +27,6 @@ "cross": "^1.0.0", "cross-env": "^7.0.3", "dotenv": "^16.4.7", - "dwengo-1-common": "^0.1.1", "express": "^5.0.1", "express-jwt": "^8.5.1", "gift-pegjs": "^1.0.2", diff --git a/backend/src/entities/assignments/assignment.entity.ts b/backend/src/entities/assignments/assignment.entity.ts index ed8745f6..a12ffbac 100644 --- a/backend/src/entities/assignments/assignment.entity.ts +++ b/backend/src/entities/assignments/assignment.entity.ts @@ -1,4 +1,4 @@ -import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; +import { Cascade, Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; import { Class } from '../classes/class.entity.js'; import { Group } from './group.entity.js'; import { Language } from '@dwengo-1/common/util/language'; @@ -34,6 +34,7 @@ export class Assignment { @OneToMany({ entity: () => Group, mappedBy: 'assignment', + cascade: [Cascade.ALL], }) groups: Collection = new Collection(this); } diff --git a/backend/src/entities/assignments/submission.entity.ts b/backend/src/entities/assignments/submission.entity.ts index 4018c3af..b19a99eb 100644 --- a/backend/src/entities/assignments/submission.entity.ts +++ b/backend/src/entities/assignments/submission.entity.ts @@ -1,6 +1,6 @@ import { Student } from '../users/student.entity.js'; import { Group } from './group.entity.js'; -import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; +import { Entity, Enum, ManyToOne, PrimaryKey, Property, Cascade } from '@mikro-orm/core'; import { SubmissionRepository } from '../../data/assignments/submission-repository.js'; import { Language } from '@dwengo-1/common/util/language'; @@ -21,8 +21,8 @@ export class Submission { @PrimaryKey({ type: 'numeric', autoincrement: false }) learningObjectVersion = 1; - @ManyToOne({ - entity: () => Group, + @ManyToOne(() => Group, { + cascade: [Cascade.REMOVE], }) onBehalfOf!: Group; diff --git a/backend/tests/data/assignments/submissions.test.ts b/backend/tests/data/assignments/submissions.test.ts index 2bbd00dc..ea2341bc 100644 --- a/backend/tests/data/assignments/submissions.test.ts +++ b/backend/tests/data/assignments/submissions.test.ts @@ -17,6 +17,7 @@ import { ClassRepository } from '../../../src/data/classes/class-repository'; import { Submission } from '../../../src/entities/assignments/submission.entity'; import { Class } from '../../../src/entities/classes/class.entity'; import { Assignment } from '../../../src/entities/assignments/assignment.entity'; +import { testLearningObject01 } from '../../test_assets/content/learning-objects.testdata'; describe('SubmissionRepository', () => { let submissionRepository: SubmissionRepository; @@ -106,7 +107,7 @@ describe('SubmissionRepository', () => { }); it('should not find a deleted submission', async () => { - const id = new LearningObjectIdentifier('id01', Language.English, 1); + const id = new LearningObjectIdentifier(testLearningObject01.hruid, testLearningObject01.language, testLearningObject01.version); await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(id, 1); const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(id, 1); diff --git a/frontend/package.json b/frontend/package.json index b6bd5deb..4be35d40 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -18,6 +18,7 @@ "dependencies": { "@tanstack/react-query": "^5.69.0", "@tanstack/vue-query": "^5.69.0", + "@vueuse/core": "^13.1.0", "axios": "^1.8.2", "oidc-client-ts": "^3.1.0", "uuid": "^11.1.0", diff --git a/frontend/src/assets/assignment.css b/frontend/src/assets/assignment.css new file mode 100644 index 00000000..029dec22 --- /dev/null +++ b/frontend/src/assets/assignment.css @@ -0,0 +1,49 @@ +.container { + display: flex; + justify-content: center; + align-items: center; + padding: 2%; + min-height: 100vh; +} + +.assignment-card { + width: 80%; + padding: 2%; + border-radius: 12px; +} + +.description { + margin-top: 2%; + line-height: 1.6; + font-size: 1.1rem; +} + +.top-right-btn { + position: absolute; + right: 2%; + color: red; +} + +.group-section { + margin-top: 2rem; +} + +.group-section h3 { + margin-bottom: 0.5rem; +} + +.group-section ul { + padding-left: 1.2rem; + list-style-type: disc; +} + +.subtitle-section { + display: flex; + align-items: center; + justify-content: space-between; +} + +.assignmentTopTitle { + white-space: normal; + word-break: break-word; +} diff --git a/frontend/src/components/BrowseThemes.vue b/frontend/src/components/BrowseThemes.vue index 805d2720..b65c4e26 100644 --- a/frontend/src/components/BrowseThemes.vue +++ b/frontend/src/components/BrowseThemes.vue @@ -11,7 +11,7 @@ selectedAge: { type: String, required: true }, }); - const { locale } = useI18n(); + const { t, locale } = useI18n(); const language = computed(() => locale.value); const { data: allThemes, isLoading, error } = useThemeQuery(language); @@ -74,6 +74,22 @@ class="fill-height" /> + + + diff --git a/frontend/src/components/ThemeCard.vue b/frontend/src/components/ThemeCard.vue index 7064b63c..d2420474 100644 --- a/frontend/src/components/ThemeCard.vue +++ b/frontend/src/components/ThemeCard.vue @@ -1,21 +1,26 @@