updated user management

This commit is contained in:
2025-10-16 13:16:55 +07:00
parent 8bf4f20d85
commit 273ee7a8c8
2 changed files with 28 additions and 16 deletions

View File

@@ -1,21 +1,25 @@
class UserResource {
constructor(user) {
this.id = user?.id ?? null
this.name = user?.name ?? null
this.email = user?.email ?? null
this.phone = user?.phone ?? null
//this.role = user?.role ?? null
this.via = user?.login_via ?? null
this.google_id = user?.google_id ?? null
this.last_login = user?.last_login ?? null
this.created_at = user?.created_at ?? null
this.updated_at = user?.updated_at ?? null
this.id = user?.id ?? null;
this.name = user?.name ?? null;
this.email = user?.email ?? null;
this.phone = user?.phone ?? null;
this.role = user?.role ?? null;
this.branch_name = user?.branch?.name ?? null; // ambil langsung nama cabang
this.avatar_url = user?.avatar_url ?? null;
this.via = user?.login_via ?? null;
this.is_suspended = user?.is_suspended ?? null;
this.is_first_login = user?.is_first_login ?? null;
this.birth = user?.birth ?? null;
this.last_login = user?.last_login ?? null;
this.created_at = user?.created_at ?? null;
this.updated_at = user?.updated_at ?? null;
}
static collection(users) {
return users.map(user => new UserResource(user));
return users.map((user) => new UserResource(user));
}
}
module.exports = UserResource
}
module.exports = UserResource;