style: fix linting issues met Prettier
This commit is contained in:
parent
7f670030a7
commit
0c47546814
30 changed files with 233 additions and 262 deletions
|
@ -2,10 +2,10 @@ import { UnauthorizedException } from '../exceptions/unauthorized-exception.js';
|
|||
import { getLogger } from '../logging/initalize.js';
|
||||
import { AuthenticatedRequest } from '../middleware/auth/authenticated-request.js';
|
||||
import { envVars, getEnvVar } from '../util/envVars.js';
|
||||
import {createOrUpdateStudent, createStudent} from "../services/students";
|
||||
import {AuthenticationInfo} from "../middleware/auth/authentication-info";
|
||||
import {Request, Response} from "express";
|
||||
import {createOrUpdateTeacher, createTeacher} from "../services/teachers";
|
||||
import { createOrUpdateStudent, createStudent } from '../services/students';
|
||||
import { AuthenticationInfo } from '../middleware/auth/authentication-info';
|
||||
import { Request, Response } from 'express';
|
||||
import { createOrUpdateTeacher, createTeacher } from '../services/teachers';
|
||||
|
||||
interface FrontendIdpConfig {
|
||||
authority: string;
|
||||
|
@ -47,20 +47,26 @@ export function handleGetFrontendAuthConfig(_req: Request, res: Response): void
|
|||
|
||||
export async function handleHello(req: AuthenticatedRequest): Promise<void> {
|
||||
const auth: AuthenticationInfo = req.auth!;
|
||||
if (auth.accountType === "teacher") {
|
||||
await createTeacher({
|
||||
id: auth.username,
|
||||
username: auth.username,
|
||||
firstName: auth.firstName ?? "",
|
||||
lastName: auth.lastName ?? "",
|
||||
}, true);
|
||||
if (auth.accountType === 'teacher') {
|
||||
await createTeacher(
|
||||
{
|
||||
id: auth.username,
|
||||
username: auth.username,
|
||||
firstName: auth.firstName ?? '',
|
||||
lastName: auth.lastName ?? '',
|
||||
},
|
||||
true
|
||||
);
|
||||
} else {
|
||||
await createStudent({
|
||||
id: auth.username,
|
||||
username: auth.username,
|
||||
firstName: auth.firstName ?? "",
|
||||
lastName: auth.lastName ?? "",
|
||||
}, true);
|
||||
await createStudent(
|
||||
{
|
||||
id: auth.username,
|
||||
username: auth.username,
|
||||
firstName: auth.firstName ?? '',
|
||||
lastName: auth.lastName ?? '',
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Request, Response } from 'express';
|
|||
import { requireFields } from './error-helper.js';
|
||||
import { createInvitation, deleteInvitation, getAllInvitations, getInvitation, updateInvitation } from '../services/teacher-invitations.js';
|
||||
import { TeacherInvitationData } from '@dwengo-1/common/interfaces/teacher-invitation';
|
||||
import {ConflictException} from "../exceptions/conflict-exception";
|
||||
import { ConflictException } from '../exceptions/conflict-exception';
|
||||
|
||||
export async function getAllInvitationsHandler(req: Request, res: Response): Promise<void> {
|
||||
const username = req.params.username;
|
||||
|
@ -31,8 +31,8 @@ export async function createInvitationHandler(req: Request, res: Response): Prom
|
|||
const classId = req.body.class;
|
||||
requireFields({ sender, receiver, classId });
|
||||
|
||||
if (sender === receiver){
|
||||
throw new ConflictException("Cannot send an invitation to yourself");
|
||||
if (sender === receiver) {
|
||||
throw new ConflictException('Cannot send an invitation to yourself');
|
||||
}
|
||||
|
||||
const data = req.body as TeacherInvitationData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue