mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
24 lines
631 B
TypeScript
24 lines
631 B
TypeScript
import {NextFunction, Request, Response} from 'express';
|
|
import {UserRoles} from '../../common/entities/UserDTO';
|
|
import {NotificationManager} from '../model/NotifocationManager';
|
|
|
|
const LOG_TAG = '[NotificationMWs]';
|
|
|
|
export class NotificationMWs {
|
|
|
|
|
|
public static list(req: Request, res: Response, next: NextFunction) {
|
|
|
|
if (req.session.user.role >= UserRoles.Admin) {
|
|
req.resultPipe = NotificationManager.notifications;
|
|
} else if (NotificationManager.notifications.length > 0) {
|
|
|
|
req.resultPipe = NotificationManager.HasNotification;
|
|
} else {
|
|
req.resultPipe = [];
|
|
}
|
|
|
|
return next();
|
|
}
|
|
}
|