From ffc107b2026b7a3c272e60e514e4faa8bbcc49ef Mon Sep 17 00:00:00 2001 From: kilted-andres Date: Mon, 12 Aug 2024 15:24:57 +0200 Subject: [PATCH] try: to make attestationsCreated optional on creation --- src/models/ctype.ts | 3 +-- src/pages/ctype.ts | 4 +--- src/utilities/indexer/queryCTypes.ts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/models/ctype.ts b/src/models/ctype.ts index d0d7e69a..88ee82b9 100644 --- a/src/models/ctype.ts +++ b/src/models/ctype.ts @@ -15,14 +15,13 @@ interface CTypeDataInput extends Omit { createdAt: Date; block: string | null; description: string | null; - attestationsCreated: number; } export interface CTypeData extends CTypeDataInput { isHidden: boolean; tags?: Array>; + attestationsCreated: number; } - export class CType extends Model {} export const CTypeModelDefinition: ModelAttributes = { diff --git a/src/pages/ctype.ts b/src/pages/ctype.ts index 40565440..7c38ef79 100644 --- a/src/pages/ctype.ts +++ b/src/pages/ctype.ts @@ -14,14 +14,13 @@ import { getRequestJson } from '../utilities/getRequestJson'; interface Input { cType: unknown; creator: DidUri; - attestationsCreated: number; description: string; tags: string[]; } export async function POST({ request, url }: APIContext) { try { - const { cType, creator, attestationsCreated, description, tags } = + const { cType, creator, description, tags } = await getRequestJson(request); if (!CType.isICType(cType)) { @@ -53,7 +52,6 @@ export async function POST({ request, url }: APIContext) { schema, creator, description, - attestationsCreated, createdAt: new Date(), ...rest, }); diff --git a/src/utilities/indexer/queryCTypes.ts b/src/utilities/indexer/queryCTypes.ts index 49962c1f..295fa9e3 100644 --- a/src/utilities/indexer/queryCTypes.ts +++ b/src/utilities/indexer/queryCTypes.ts @@ -78,7 +78,7 @@ export async function queryCTypes() { creator, block: registrationBlock.id, ...rest, - attestationsCreated, + attestationsCreated, // problem here }); logger.info( `Added new CType to data base: ${JSON.stringify(newCType, null, 2)}`,