fix: invitation geeft enkel classId field terug
This commit is contained in:
		
							parent
							
								
									5624f3bbfe
								
							
						
					
					
						commit
						834e991568
					
				
					 4 changed files with 11 additions and 7 deletions
				
			
		|  | @ -10,7 +10,7 @@ export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): Teache | |||
|     return { | ||||
|         sender: mapToUserDTO(invitation.sender), | ||||
|         receiver: mapToUserDTO(invitation.receiver), | ||||
|         class: mapToClassDTO(invitation.class), | ||||
|         classId: invitation.class.classId!, | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  | @ -18,7 +18,7 @@ export function mapToTeacherInvitationDTOIds(invitation: TeacherInvitation): Tea | |||
|     return { | ||||
|         sender: invitation.sender.username, | ||||
|         receiver: invitation.receiver.username, | ||||
|         class: invitation.class.classId!, | ||||
|         classId: invitation.class.classId!, | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ import { makeTestAttachments } from './test_assets/content/attachments.testdata. | |||
| import { makeTestQuestions } from './test_assets/questions/questions.testdata.js'; | ||||
| import { makeTestAnswers } from './test_assets/questions/answers.testdata.js'; | ||||
| import { makeTestSubmissions } from './test_assets/assignments/submission.testdata.js'; | ||||
| import {Collection} from "@mikro-orm/core"; | ||||
| 
 | ||||
| export async function setupTestApp(): Promise<void> { | ||||
|     dotenv.config({ path: '.env.test' }); | ||||
|  | @ -28,8 +29,8 @@ export async function setupTestApp(): Promise<void> { | |||
|     const assignments = makeTestAssignemnts(em, classes); | ||||
|     const groups = makeTestGroups(em, students, assignments); | ||||
| 
 | ||||
|     assignments[0].groups = groups.slice(0, 3); | ||||
|     assignments[1].groups = groups.slice(3, 4); | ||||
|     assignments[0].groups = new Collection(groups.slice(0, 3)); | ||||
|     assignments[1].groups = new Collection(groups.slice(3, 4)); | ||||
| 
 | ||||
|     const teacherInvitations = makeTestTeacherInvitations(em, teachers, classes); | ||||
|     const classJoinRequests = makeTestClassJoinRequests(em, students, classes); | ||||
|  | @ -41,6 +42,9 @@ export async function setupTestApp(): Promise<void> { | |||
|     const answers = makeTestAnswers(em, teachers, questions); | ||||
|     const submissions = makeTestSubmissions(em, students, groups); | ||||
| 
 | ||||
|     console.log("classes", classes); | ||||
|     console.log("invitations", teacherInvitations); | ||||
| 
 | ||||
|     await em.persistAndFlush([ | ||||
|         ...students, | ||||
|         ...teachers, | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { ClassDTO } from './class'; | |||
| export interface TeacherInvitationDTO { | ||||
|     sender: string | UserDTO; | ||||
|     receiver: string | UserDTO; | ||||
|     class: string | ClassDTO; | ||||
|     classId: string; | ||||
| } | ||||
| 
 | ||||
| export interface TeacherInvitationData { | ||||
|  |  | |||
|  | @ -276,10 +276,10 @@ | |||
|                 <tbody> | ||||
|                     <tr | ||||
|                         v-for="i in invitations" | ||||
|                         :key="(i.class as ClassDTO).id" | ||||
|                         :key="i.classId" | ||||
|                     > | ||||
|                         <td> | ||||
|                             {{ (i.class as ClassDTO).displayName }} | ||||
|                           {{ i.classId }} <!-- TODO fetch display name via classId because db only returns classId field --> | ||||
|                         </td> | ||||
|                         <td>{{ (i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName }}</td> | ||||
|                         <td class="text-right"> | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl