From 5937fba5ee768d6b7206aa9ffbc6afbacb93a976 Mon Sep 17 00:00:00 2001 From: Richa-iitr Date: Thu, 4 Aug 2022 20:19:16 +0530 Subject: [PATCH] minor changes --- generated/schema.ts | 21 ++++++--------------- schema.graphql | 3 +-- src/insta-automation.ts | 22 ++++++++++++++-------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/generated/schema.ts b/generated/schema.ts index 423b5e5..57543d2 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -751,7 +751,7 @@ export class SystemCancelData extends Entity { } } -export class Executors extends Entity { +export class Executor extends Entity { constructor(id: string) { super(); this.set("id", Value.fromString(id)); @@ -759,18 +759,18 @@ export class Executors extends Entity { save(): void { let id = this.get("id"); - assert(id != null, "Cannot save Executors entity without an ID"); + assert(id != null, "Cannot save Executor entity without an ID"); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type Executors must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + `Entities of type Executor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); - store.set("Executors", id.toString(), this); + store.set("Executor", id.toString(), this); } } - static load(id: string): Executors | null { - return changetype(store.get("Executors", id)); + static load(id: string): Executor | null { + return changetype(store.get("Executor", id)); } get id(): string { @@ -790,13 +790,4 @@ export class Executors extends Entity { set executors(value: Array) { this.set("executors", Value.fromBytesArray(value)); } - - get status(): Array { - let value = this.get("status"); - return value!.toBooleanArray(); - } - - set status(value: Array) { - this.set("status", Value.fromBooleanArray(value)); - } } diff --git a/schema.graphql b/schema.graphql index 8200396..ed0260c 100644 --- a/schema.graphql +++ b/schema.graphql @@ -84,8 +84,7 @@ type SystemCancelData @entity { account: Account! } -type Executors @entity { +type Executor @entity { id: ID! executors: [Bytes!]! - status: [Boolean!]! } \ No newline at end of file diff --git a/src/insta-automation.ts b/src/insta-automation.ts index 7c0a465..f46d82d 100644 --- a/src/insta-automation.ts +++ b/src/insta-automation.ts @@ -18,7 +18,7 @@ import { SubmitData, CancelData, SystemCancelData, - Executors + Executor } from "../generated/schema"; import { createOrLoadCancelData, @@ -184,19 +184,25 @@ export function handleLogExecuteAutomation( export function handleExecutors(event: LogFlippedExecutors): void { let id = "ALL" - let executors_ = Executors.load(id); + let executors_ = Executor.load(id); if(executors_ == null){ - executors_ = new Executors(id); + executors_ = new Executor(id); executors_.executors = []; - executors_.status = []; } let execArr = executors_.executors; - let statusArr = executors_.status; + let statusArr = event.params.status; for(let i=0;i