diff --git a/src/controllers/AccountController.ts b/src/controllers/AccountController.ts index 61f2c32..1eb31c9 100644 --- a/src/controllers/AccountController.ts +++ b/src/controllers/AccountController.ts @@ -220,8 +220,18 @@ export class AccountController { public static async ExportData(h: RequestHandler) { await h.needUserPostPassword("password"); - // TODO : implement - h.error(500, "Method not implemented yet."); + const data = await AccountHelper.Export(h.getUserId()); + + const out: any = { + userID: data.userID + }; + + + + // TODO : continue + + + h.send(out); } /** diff --git a/src/entities/AccountExport.ts b/src/entities/AccountExport.ts new file mode 100644 index 0000000..10b4082 --- /dev/null +++ b/src/entities/AccountExport.ts @@ -0,0 +1,20 @@ +/** + * Account data export + * + * @author Pierre Hubert + */ + +export interface AccountExportBuilder { + userID: number; +} + +export class AccountExport implements AccountExportBuilder { + userID: number; + + public constructor(info: AccountExportBuilder) { + for (const key in info) { + if (info.hasOwnProperty(key)) + this[key] = info[key]; + } + } +} \ No newline at end of file diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 6eb3726..e87b1ad 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -6,6 +6,7 @@ import { UserHelper } from "./UserHelper"; import { time, mysql_date } from "../utils/DateUtils"; import { NewAccount } from "../entities/NewAccount"; import { GeneralSettings, UserPageStatus, LangSettings, SecuritySettings } from "../entities/User"; +import { AccountExport } from "../entities/AccountExport"; /** * Account helper @@ -374,4 +375,20 @@ export class AccountHelper { } }); } + + /** + * Export all the data of an account + * + * @param userID Target user ID + */ + public static async Export(userID: number) : Promise { + const data = new AccountExport({ + userID: userID + }) + + + // TODO : continue + + return data; + } } \ No newline at end of file