Files
ROLAC/APP/src/app/features/members/models/member.model.ts
T
Chris Chen 4dc7ff7df7
ci-cd-vm / ci-cd (push) Successful in 1m38s
Update member.model.ts
2026-06-24 12:07:02 -07:00

92 lines
2.3 KiB
TypeScript

export type MemberStatus = 'Member' | 'Visitor' | 'Inactive' | 'Former';
export interface MemberListItemDto {
id: number;
firstName_en: string;
lastName_en: string;
nickName: string | null;
firstName_zh: string | null;
lastName_zh: string | null;
entity: string | null;
status: MemberStatus;
email: string | null;
phoneCell: string | null;
joinDate: string | null;
linkedUserId: string | null;
}
export interface MemberDto extends MemberListItemDto {
gender: string | null;
dateOfBirth: string | null;
baptismDate: string | null;
baptismChurch: string | null;
phoneHome: string | null;
address: string | null;
city: string | null;
state: string | null;
zipCode: string | null;
country: string;
photoBlobPath: string | null;
languagePreference: string;
notes: string | null;
familyUnitId: number | null;
createdAt: string;
updatedAt: string;
}
export interface CreateMemberRequest {
firstName_en: string;
lastName_en: string;
nickName: string | null;
firstName_zh: string | null;
lastName_zh: string | null;
entity: string | null;
gender: string | null;
dateOfBirth: string | null;
baptismDate: string | null;
baptismChurch: string | null;
email: string | null;
phoneCell: string | null;
phoneHome: string | null;
address: string | null;
city: string | null;
state: string | null;
zipCode: string | null;
country: string;
status: string;
languagePreference: string;
joinDate: string | null;
notes: string | null;
familyUnitId: number | null;
}
export type UpdateMemberRequest = CreateMemberRequest;
export interface PagedResult<T> {
items: T[];
totalCount: number;
page: number;
pageSize: number;
totalPages: number;
}
export interface MemberQueryParams {
page?: number;
pageSize?: number;
search?: string;
status?: string;
hasUser?: boolean;
}
/** Display name: NickName (if present) else FirstName_en, plus LastName_en */
export function memberDisplayName(
m: Pick<MemberListItemDto, 'nickName' | 'firstName_en' | 'lastName_en' | 'entity'>
): string {
const legal = `${m.firstName_en} ${m.lastName_en}`.trim();
const base = (m.nickName && m.nickName !== m.firstName_en)
? `${m.nickName} ${m.lastName_en} (${legal})`
: legal;
// Append the company / business name so a company-check giver is unambiguous.
return m.entity ? `${base} · ${m.entity}` : base;
}