Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1022 update user #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

1022 update user #218

wants to merge 2 commits into from

Conversation

pagum
Copy link
Contributor

@pagum pagum commented Feb 8, 2023

update User to return picture

@pagum pagum self-assigned this Feb 8, 2023
@Ndifreke
Copy link
Contributor

Ndifreke commented Feb 10, 2023

@pagum this would be a great opportunity to fix the type of this Component.
There seem to be some types that should belong to /me which are mixed up here the proper type for User is

export interface UserInterface {
  id: string;
  deactivated: boolean;
  namespace: string;
  username: string;
  email: string;
  email_verified?: boolean;
  first_name: string;
  last_name: string;
  picture: string;
  company: string;
  website: string;
  country: string;
  created_at: string;
  updated_at: string;
  phone_number_verified: boolean
  mfa_enabled: boolean
}

export default class User extends Ressource implements UserInterface {
  id: string;
  created_at: string;
  updated_at: string;
  has_key: boolean;
  // display_name: string; Does not exist in User but in Me
  email: string;
  username: string;
  deactivated: boolean;
  namespace: string;
  email_verified?: boolean;
  first_name: string;
  last_name: string;
  picture = "";
  company: string;
  website : string;
  country: string;
  phone_number_verified = false;
  mfa_enabled = false

  constructor(user: APIObject, url = `${_url}/:id`, modifiableField: Array<string> = []) {
    const { id } = user;

    super(url, paramDefaults, { id }, user, [], modifiableField);
    this._queryUrl = Ressource.getQueryUrl(url);
    this.id = "";
    this.created_at = "";
    this.updated_at = "";
    this.has_key = false;
    this.email = "";
    this.username = "";
    this.country = "";
    this.website = "";
    this.company = "";
    this.last_name = "";
    this.first_name = "";
    this.deactivated = false;
    this.namespace = "";
  }

You will have to remove this.picture from Me and let the super class handle the construction and then move this.display_name to Me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants