Nueva bdd y entidades generales
This commit is contained in:
20
packages/shared/domain/SimCard.ts
Normal file
20
packages/shared/domain/SimCard.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { User } from "./User"
|
||||
|
||||
export type SimCard = {
|
||||
iccid: string,
|
||||
imei: string,
|
||||
|
||||
/* Pedido de shopify */
|
||||
orderdId?: string, // Pasar a tipo
|
||||
|
||||
/* Subscripcion de shopify */
|
||||
subscriptionId?: string, // Pasar a tipo
|
||||
|
||||
user?: User
|
||||
|
||||
createdAt?: Date,
|
||||
updatedAt?: Date,
|
||||
|
||||
codigoOrigen?: string,
|
||||
}
|
||||
|
||||
@@ -36,4 +36,14 @@ export namespace SimEvents {
|
||||
options: {
|
||||
}
|
||||
}
|
||||
|
||||
export type save = DomainEvent & {
|
||||
key: "sim.save",
|
||||
payload: {
|
||||
iccid: string,
|
||||
imei: string
|
||||
},
|
||||
options: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
0
packages/shared/domain/SimOrder.ts
Normal file
0
packages/shared/domain/SimOrder.ts
Normal file
0
packages/shared/domain/SimSubscription.ts
Normal file
0
packages/shared/domain/SimSubscription.ts
Normal file
6
packages/shared/domain/User.ts
Normal file
6
packages/shared/domain/User.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export type User = {
|
||||
userId: string,
|
||||
userName?: string,
|
||||
email?: string,
|
||||
tlfn?: string,
|
||||
}
|
||||
@@ -17,6 +17,23 @@ export class SimUsecases {
|
||||
this.eventBus = args.eventBus
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea una nueva sim de la que no se tenia registro anteriormente
|
||||
* Si ya existia se modifican los campos pero no se hace un cambio
|
||||
* de estado.
|
||||
*/
|
||||
async save(args: { iccid: string, imei: string }) {
|
||||
const activationEvent = <SimEvents.save>{
|
||||
key: "sim.save",
|
||||
payload: {
|
||||
iccid: args.iccid,
|
||||
imei: args.imei
|
||||
}
|
||||
}
|
||||
|
||||
return this.eventBus.publish([activationEvent])
|
||||
}
|
||||
|
||||
async activation(args: { iccid: string }) {
|
||||
const activationEvent = <SimEvents.activation>{
|
||||
key: "sim.activation",
|
||||
|
||||
Reference in New Issue
Block a user