145 lines
3.6 KiB
TypeScript
145 lines
3.6 KiB
TypeScript
export type ObjeniousLineResponse = {
|
|
content: ObjeniousLine[],
|
|
offset: number,
|
|
pageNumber: number,
|
|
pageSize: number,
|
|
paged: boolean,
|
|
totalPages: number,
|
|
totalElements: number
|
|
}
|
|
|
|
export type ObjeniousLine = {
|
|
identifier: {
|
|
simId: number,
|
|
iccid: string,
|
|
imsi: string,
|
|
msisdn: string,
|
|
amsisdn?: string,
|
|
imei: string
|
|
},
|
|
simCardType: {
|
|
code: string,
|
|
description: string
|
|
},
|
|
device: {
|
|
imei: string,
|
|
imeiChangeDate: string, //Fecha iso
|
|
deviceReference?: string | null,
|
|
manufacturer?: string | null,
|
|
},
|
|
customerAccount: {
|
|
code: string,
|
|
label: string,
|
|
address: {
|
|
address1: string,
|
|
address2: string,
|
|
address3: string,
|
|
zipCode: string,
|
|
city: string,
|
|
country: string,
|
|
state?: string | null
|
|
}
|
|
},
|
|
offer: {
|
|
code: string,
|
|
description: string,
|
|
},
|
|
party: {
|
|
name: string,
|
|
code: string,
|
|
contractReference: string,
|
|
partyType: string,
|
|
},
|
|
lineCustomFields: {
|
|
custom1: {
|
|
label: string | null,
|
|
value: string | null
|
|
},
|
|
custom2: {
|
|
label: string | null,
|
|
value: string | null
|
|
},
|
|
custom3: {
|
|
label: string | null,
|
|
value: string | null
|
|
},
|
|
custom4: {
|
|
label: string | null,
|
|
value: string | null
|
|
},
|
|
custom5: {
|
|
label: string | null,
|
|
value: string | null
|
|
},
|
|
custom6: {
|
|
label: string | null,
|
|
value: string | null
|
|
}
|
|
},
|
|
status: {
|
|
status: string,
|
|
preactivationDate: string | null, //"2026-03-17",
|
|
activationDate: string | null, //"2026-03-17T11:04:11.408+00:00",
|
|
commercialStatus: string, //"test",
|
|
commercialStatusDate: string, //"2026-03-17T11:41:01.493+00:00",
|
|
networkStatus: string, // "ACTIVATED",
|
|
billingStatus: string, //"TEST",
|
|
billingStatusChangeDate: string | null, // "2026-03-17T11:01:00.276+00:00",
|
|
billingActivationDate: string | null //,
|
|
createdDate: string | null,//"2026-01-30T01:50:02.060+00:00"
|
|
},
|
|
services: string | null
|
|
};
|
|
|
|
export type ObjeniousLineDb = {
|
|
id: number;
|
|
simId?: number;
|
|
iccid: string;
|
|
msisdn?: string;
|
|
imei?: string;
|
|
imeiChangeDate?: Date;
|
|
offerCode?: string;
|
|
status?: string;
|
|
preactivationDate?: Date | null;
|
|
activationDate?: Date | null;
|
|
commercialStatus?: string;
|
|
commercialStatusDate?: Date | null;
|
|
billingStatus?: string;
|
|
billingStatusChangeDate?: Date | null;
|
|
billingActivationDate?: Date | null;
|
|
createDate?: Date | null;
|
|
raw: ObjeniousLine;
|
|
}
|
|
|
|
// DTO para inserción (omite el ID autogenerado)
|
|
export type CreateObjeniousLineDTO = Omit<ObjeniousLineDb, 'id'>;
|
|
|
|
export function lineToCreateLineDto(line: ObjeniousLine): CreateObjeniousLineDTO {
|
|
|
|
const dateOrNull = (data: string | null) => {
|
|
if (data == null) return null;
|
|
return new Date(data)
|
|
}
|
|
|
|
const transformed: CreateObjeniousLineDTO = {
|
|
simId: line.identifier.simId,
|
|
iccid: line.identifier.iccid,
|
|
msisdn: line.identifier.msisdn,
|
|
imei: line.identifier.imei,
|
|
imeiChangeDate: new Date(line.device.imeiChangeDate),
|
|
offerCode: line.offer.code,
|
|
status: line.status.status,
|
|
preactivationDate: dateOrNull(line.status.preactivationDate),
|
|
activationDate: dateOrNull(line.status.activationDate),
|
|
commercialStatus: line.status.commercialStatus,
|
|
commercialStatusDate: dateOrNull(line.status.commercialStatusDate),
|
|
billingStatus: line.status.billingStatus,
|
|
billingStatusChangeDate: dateOrNull(line.status.activationDate),
|
|
billingActivationDate: dateOrNull(line.status.activationDate),
|
|
createDate: dateOrNull(line.status.activationDate),
|
|
raw: line
|
|
}
|
|
|
|
return transformed;
|
|
}
|