From 1fb4563d722fc96a227afa154d2335ee09a09fd1 Mon Sep 17 00:00:00 2001 From: Benjamin Petetot Date: Tue, 19 Nov 2024 16:58:48 +0100 Subject: [PATCH] feat(mon-pix): call /my-account endpoint on MyAccount page --- mon-pix/app/models/account-info.js | 7 +++++++ mon-pix/app/models/user.js | 1 + mon-pix/app/templates/authenticated/user-account.hbs | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 mon-pix/app/models/account-info.js diff --git a/mon-pix/app/models/account-info.js b/mon-pix/app/models/account-info.js new file mode 100644 index 00000000000..43fee59bedf --- /dev/null +++ b/mon-pix/app/models/account-info.js @@ -0,0 +1,7 @@ +import Model, { attr } from '@ember-data/model'; + +export default class AccountInfo extends Model { + @attr('string') email; + @attr('string') username; + @attr('boolean') canSelfDeleteAccount; +} diff --git a/mon-pix/app/models/user.js b/mon-pix/app/models/user.js index d7cd6b6cfd0..f6f917c4ffb 100644 --- a/mon-pix/app/models/user.js +++ b/mon-pix/app/models/user.js @@ -26,6 +26,7 @@ export default class User extends Model { // includes @belongsTo('is-certifiable', { async: true, inverse: null }) isCertifiable; @belongsTo('profile', { async: true, inverse: null }) profile; + @belongsTo('account-info', { async: true, inverse: null }) accountInfo; @hasMany('certification', { async: true, inverse: 'user' }) certifications; @hasMany('scorecard', { async: true, inverse: null }) scorecards; @hasMany('training', { async: true, inverse: null }) trainings; diff --git a/mon-pix/app/templates/authenticated/user-account.hbs b/mon-pix/app/templates/authenticated/user-account.hbs index 65ce44d7748..fe78beff1b8 100644 --- a/mon-pix/app/templates/authenticated/user-account.hbs +++ b/mon-pix/app/templates/authenticated/user-account.hbs @@ -32,6 +32,11 @@ {{/if}} + {{#if @model.accountInfo.canSelfDeleteAccount}} +
  • + {{! ADD DELETE ACCOUNT LINK HERE }} +
  • + {{/if}}