Order para pause, activate y terminate

This commit is contained in:
2026-02-25 17:42:16 +01:00
parent f221035c8b
commit 18422fbe38
3 changed files with 16 additions and 10 deletions

View File

@@ -111,7 +111,7 @@ export class SimUsecases {
const activationWithId = this.addMessage_id(activationEvent)
console.log("[d] Activation ", activationWithId)
await this.eventBus.publish([activationWithId])
this.saveOrder(activationWithId)
await this.saveOrder(activationWithId)
}
async preActivation(args: { iccid: string, compañia: string }) {
@@ -131,14 +131,18 @@ export class SimUsecases {
*/
async cancelation(args: { iccid: string, compañia: string }) {
const activationEvent = <SimEvents.cancel>{
const cancelationEvent = <SimEvents.cancel>{
key: `sim.${args.compañia}.cancel`,
payload: {
iccid: args.iccid
}
}
console.log("[d] Cancelation ", activationEvent)
return this.eventBus.publish([activationEvent])
const cancelationWithId = this.addMessage_id(cancelationEvent)
console.log("[d] Cancelation ", cancelationWithId)
await this.eventBus.publish([cancelationWithId])
await this.saveOrder(cancelationWithId)
return cancelationWithId
}
// alias por si acaso
public terminate = this.cancelation;
@@ -147,15 +151,18 @@ export class SimUsecases {
* alias de bloquear / suspender en objenious
*/
async pause(args: { iccid: string, compañia: string }) {
const cancelationEvent = <SimEvents.pause>{
const pauseEvent = <SimEvents.pause>{
key: `sim.${args.compañia}.pause`,
payload: {
iccid: args.iccid
}
}
return this.eventBus.publish([cancelationEvent])
const pauseWithId = this.addMessage_id(pauseEvent)
await this.eventBus.publish([pauseWithId])
await this.saveOrder(pauseWithId)
return pauseWithId
}
async free(args: { iccid: string, compañia: string }) {
const cancelationEvent = <SimEvents.free>{
key: `sim.${args.compañia}.free`,

View File

@@ -28,9 +28,9 @@ const orderController = new OrderController({
* */
orderRoutes.get("/", (req, res) => { res.send("ok") })
orderRoutes.get("/message_id/:correlation_id", orderController.getByQueueId())
/** Operaciones pendientes */
orderRoutes.get("/pending", orderController.getPending())
/** Order por id (uuid del mensaje) */
@@ -38,4 +38,3 @@ orderRoutes.get("/:id", orderController.getById())
export { orderRoutes }