✨ Make history API compatible with frontend
This commit is contained in:
@ -101,6 +101,9 @@ export async function getHistory(req, res) {
|
|||||||
include: {
|
include: {
|
||||||
substitution: true,
|
substitution: true,
|
||||||
},
|
},
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
if (requestedClass) {
|
if (requestedClass) {
|
||||||
prismaOptions.where.substitution.class = { has: requestedClass };
|
prismaOptions.where.substitution.class = { has: requestedClass };
|
||||||
|
@ -130,7 +130,17 @@ export class Parser {
|
|||||||
data: {
|
data: {
|
||||||
substitutionId: newSubstitution.id,
|
substitutionId: newSubstitution.id,
|
||||||
type: "addition",
|
type: "addition",
|
||||||
changes: {},
|
changes: {
|
||||||
|
class: classes,
|
||||||
|
type: change.type == "Entfall" ? "cancellation" : "change",
|
||||||
|
lesson: parseInt(change.lesson),
|
||||||
|
date: new Date(date),
|
||||||
|
change: {
|
||||||
|
teacher: change.changedTeacher,
|
||||||
|
room: change.room || undefined,
|
||||||
|
subject: change.subject,
|
||||||
|
},
|
||||||
|
},
|
||||||
parseEventId: parseEvent.id,
|
parseEventId: parseEvent.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user