Skip to content

Fix User interfaces #586

@Ribas160

Description

@Ribas160

Get authenticated user
Edit authenticated user

The User interface does not match the structure in the documentation.

For now the User interface is:

export interface User {
id: number;
username: string;
email: string;
firstName: string;
lastName: string;
status: Status;
avatarUrl: string;
fields: Record<string, any>;
createdAt: string;
lastSeen: string;
twoFactor: TwoFactor;
isAdmin: boolean;
timezone: string;
emailVerified: string;
}

But in doc it is:

{
  "data": {
    "id": 12,
    "username": "john_smith",
    "email": "[email protected]",
    "emailVerified": "false",
    "fullName": "John Smith",
    "avatarUrl": "",
    "createdAt": "2019-07-11T07:40:22+00:00",
    "lastSeen": "2019-10-23T11:44:02+00:00",
    "twoFactor": "enabled",
    "timezone": "Europe/Kyiv"
  }
}

Also the project has duplicated User interfaces with shorter data

export interface User {
id: number;
username: string;
fullName: string;
avatarUrl: string;
}

export interface User {


export interface User {

I suggest to create a ShortUser interface in UsersModel and using it instead of the duplicate interfaces mentioned above. I also suggest to extend the main UsersModel.User interface with UsersModel.ShortUser to avoid duplicating parameters.

  export interface ShortUser {
      id: number;
      username: string;
      fullName: string;
      avatarUrl: string;
  }

This is the issue described in #585 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions