fix: vervang v4 naar 6 char class id

This commit is contained in:
Gabriellvl 2025-05-04 13:51:07 +02:00
parent 509dd6bfab
commit 81e0af28cc
2 changed files with 6 additions and 2 deletions

View file

@ -1,15 +1,18 @@
import { Collection, Entity, ManyToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { v4 } from 'uuid';
import { Teacher } from '../users/teacher.entity.js';
import { Student } from '../users/student.entity.js';
import { ClassRepository } from '../../data/classes/class-repository.js';
import { customAlphabet } from "nanoid";
const generateClassId = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', 6);
@Entity({
repository: () => ClassRepository,
})
export class Class {
@PrimaryKey()
classId? = v4();
classId? = generateClassId();
@Property({ type: 'string' })
displayName!: string;