style: fix linting issues met Prettier
This commit is contained in:
parent
e78849f568
commit
400a955850
40 changed files with 321 additions and 700 deletions
|
@ -1,19 +1,9 @@
|
|||
import { Request, Response } from 'express';
|
||||
import {
|
||||
createClass,
|
||||
getAllClasses,
|
||||
getClass,
|
||||
getClassStudents,
|
||||
getClassStudentsIds,
|
||||
getClassTeacherInvitations,
|
||||
} from '../services/class.js';
|
||||
import { createClass, getAllClasses, getClass, getClassStudents, getClassStudentsIds, getClassTeacherInvitations } from '../services/class.js';
|
||||
import { ClassDTO, mapToClass } from '../interfaces/class.js';
|
||||
import { getClassRepository, getStudentRepository, getTeacherRepository } from '../data/repositories.js';
|
||||
|
||||
export async function getAllClassesHandler(
|
||||
req: Request,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
export async function getAllClassesHandler(req: Request, res: Response): Promise<void> {
|
||||
const full = req.query.full === 'true';
|
||||
const classes = await getAllClasses(full);
|
||||
|
||||
|
@ -22,10 +12,7 @@ export async function getAllClassesHandler(
|
|||
});
|
||||
}
|
||||
|
||||
export async function createClassHandler(
|
||||
req: Request,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
export async function createClassHandler(req: Request, res: Response): Promise<void> {
|
||||
const classData = req.body as ClassDTO;
|
||||
|
||||
if (!classData.displayName) {
|
||||
|
@ -38,17 +25,14 @@ export async function createClassHandler(
|
|||
const cls = await createClass(classData);
|
||||
|
||||
if (!cls) {
|
||||
res.status(500).json({ error: "Something went wrong while creating class" });
|
||||
return
|
||||
res.status(500).json({ error: 'Something went wrong while creating class' });
|
||||
return;
|
||||
}
|
||||
|
||||
res.status(201).json({ class: cls });
|
||||
}
|
||||
|
||||
export async function getClassHandler(
|
||||
req: Request,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
export async function getClassHandler(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
const classId = req.params.id;
|
||||
const cls = await getClass(classId);
|
||||
|
@ -71,26 +55,18 @@ export async function getClassHandler(
|
|||
}
|
||||
}
|
||||
|
||||
export async function getClassStudentsHandler(
|
||||
req: Request,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
export async function getClassStudentsHandler(req: Request, res: Response): Promise<void> {
|
||||
const classId = req.params.id;
|
||||
const full = req.query.full === 'true';
|
||||
|
||||
const students = full
|
||||
? await getClassStudents(classId)
|
||||
: await getClassStudentsIds(classId);
|
||||
const students = full ? await getClassStudents(classId) : await getClassStudentsIds(classId);
|
||||
|
||||
res.json({
|
||||
students: students,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTeacherInvitationsHandler(
|
||||
req: Request,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
export async function getTeacherInvitationsHandler(req: Request, res: Response): Promise<void> {
|
||||
const classId = req.params.id;
|
||||
const full = req.query.full === 'true'; // TODO: not implemented yet
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue