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

@ -37,6 +37,7 @@
"jwks-rsa": "^3.1.0",
"loki-logger-ts": "^1.0.2",
"marked": "^15.0.7",
"nanoid": "^5.1.5",
"response-time": "^2.3.3",
"swagger-ui-express": "^5.0.1",
"uuid": "^11.1.0",

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;