Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 59x 59x 141x 141x 141x 141x 1x 1x 1x 1x 1x 59x 59x | import { Response } from 'express';
import Controller from '../controller';
import { Logger } from '../../logger';
import { IUnleashConfig } from '../../types/option';
import { IUnleashServices } from '../../types/services';
import UserSplashService from '../../services/user-splash-service';
import { IAuthRequest } from '../unleash-types';
import { NONE } from '../../types/permissions';
interface ISplashBody {
seen: boolean;
splashId: string;
}
class UserSplashController extends Controller {
private logger: Logger;
private userSplashService: UserSplashService;
constructor(
config: IUnleashConfig,
{ userSplashService }: Pick<IUnleashServices, 'userSplashService'>,
) {
super(config);
this.logger = config.getLogger('splash-controller.ts');
this.userSplashService = userSplashService;
this.post('/:id', this.updateSplashSettings, NONE);
}
private async updateSplashSettings(
req: IAuthRequest<any, any, ISplashBody, any>,
res: Response,
): Promise<void> {
const { user } = req;
const { id } = req.params;
const splash = {
splashId: id,
userId: user.id,
seen: true,
};
const updated = await this.userSplashService.updateSplash(splash);
res.json(updated);
}
}
module.exports = UserSplashController;
export default UserSplashController;
|