1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-27 15:59:22 +00:00
comunicapiv2/src/controllers/SettingsController.ts

39 lines
988 B
TypeScript
Raw Normal View History

2020-03-21 16:16:30 +00:00
/**
* Settings controller
*
* @author Pierre HUBERT
*/
import { RequestHandler } from "../entities/RequestHandler";
import { UserHelper } from "../helpers/UserHelper";
import { UserController } from "./UserController";
export class SettingsController {
/**
* Get general account settings
*
* @param h Request handler
*/
public static async GetGeneral(h: RequestHandler) {
const userInfo = await UserHelper.GetUserInfo(h.getUserId());
h.send({
id: userInfo.id,
email: userInfo.email,
firstName: userInfo.firstName,
lastName: userInfo.lastName,
is_public: userInfo.isPublic,
is_open: userInfo.isOpen,
allow_comments: !userInfo.blockComments,
allow_posts_from_friends: userInfo.allowPostsFromFriends,
allow_comunic_mails: userInfo.allowMails,
public_friends_list: userInfo.friendsListPublic,
virtual_directory: userInfo.virtualDirectory,
personnal_website: userInfo.personnalWebsite,
publicNote: userInfo.publicNote,
})
}
}