1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 00:25:17 +00:00

Can set (update) general settings

This commit is contained in:
2020-03-21 18:05:17 +01:00
parent 46dce030d7
commit 03100e0bd3
4 changed files with 100 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import { DatabaseHelper } from "./DatabaseHelper";
import { UserHelper } from "./UserHelper";
import { time, mysql_date } from "../utils/DateUtils";
import { NewAccount } from "../entities/NewAccount";
import { GeneralSettings, UserPageStatus } from "../entities/User";
/**
* Account helper
@ -309,4 +310,31 @@ export class AccountHelper {
}
});
}
/**
* Set (save) new general settings
*
* @param settings New settings
*/
public static async SetGeneral(settings: GeneralSettings) {
await DatabaseHelper.UpdateRows({
table: USER_TABLE,
where: {
ID: settings.id
},
set: {
prenom: settings.firstName,
nom: settings.lastName,
public: settings.pageStatus != UserPageStatus.PRIVATE ? 1 : 0,
pageouverte: settings.pageStatus == UserPageStatus.OPEN ? 1 : 0,
bloquecommentaire: settings.blockComments ? 1 : 0,
autoriser_post_amis: settings.allowPostsFromFriends ? 1 : 0,
autorise_mail: settings.allowMails ? 1 : 0,
liste_amis_publique: settings.friendsListPublic ? 1 : 0,
sous_repertoire: settings.virtualDirectory,
site_web: settings.personnalWebsite,
public_note: settings.publicNote
}
});
}
}