refactor: session resource

This commit is contained in:
Carlos Valente
2024-10-20 21:49:52 +02:00
committed by Carlos Valente
parent cf40001a2a
commit 71c468d069
10 changed files with 69 additions and 54 deletions
@@ -0,0 +1,16 @@
import { getErrorMessage } from 'ontime-utils';
import { ErrorResponse, GetInfo } from 'ontime-types';
import type { Request, Response } from 'express';
import * as sessionService from './session.service.js';
export async function getInfo(_req: Request, res: Response<GetInfo | ErrorResponse>) {
try {
const info = await sessionService.getInfo();
res.status(200).send(info);
} catch (error) {
const message = getErrorMessage(error);
res.status(500).send({ message });
}
}