backend: Add callback to application to check editing key status (#525)

This commit is contained in:
Eric Doughty-Papassideris
2024-08-25 22:26:30 +02:00
parent 9b0dcc1068
commit 483b1b0688
8 changed files with 171 additions and 17 deletions
@@ -0,0 +1,21 @@
import TwakeDriveBackendCallbackController from '@/controllers/backend-callbacks.controller';
import { Routes } from '@/interfaces/routes.interface';
import authMiddleware from '@/middlewares/auth.middleware';
import { Router } from 'express';
/**
* These routes are called by Twake Drive backend, for ex. before editing or retreiving a file,
* if it has an editing_session_key still, get the status of that and force a resolution.
*/
export default class TwakeDriveBackendCallbackRoutes implements Routes {
public readonly router = Router();
public readonly path = '/tdriveApi/1';
private readonly controller: TwakeDriveBackendCallbackController;
constructor() {
this.controller = new TwakeDriveBackendCallbackController();
// Why post ? to garantee it is never cached and always ran
this.router.post('/session/:editing_session_key/check', authMiddleware, this.controller.checkSessionStatus);
this.router.delete('/session/:editing_session_key', authMiddleware, this.controller.deleteSessionKey);
}
}