Skip to content

Commit

Permalink
try: to make attestationsCreated optional on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
kilted-andres committed Aug 12, 2024
1 parent 472df34 commit ffc107b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/models/ctype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ interface CTypeDataInput extends Omit<ICType, '$id' | '$schema'> {
createdAt: Date;
block: string | null;
description: string | null;
attestationsCreated: number;
}

export interface CTypeData extends CTypeDataInput {
isHidden: boolean;
tags?: Array<Pick<Tag, 'dataValues'>>;
attestationsCreated: number;
}

export class CType extends Model<CTypeData, CTypeDataInput> {}

export const CTypeModelDefinition: ModelAttributes = {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/ctype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Input>(request);

if (!CType.isICType(cType)) {
Expand Down Expand Up @@ -53,7 +52,6 @@ export async function POST({ request, url }: APIContext) {
schema,
creator,
description,
attestationsCreated,
createdAt: new Date(),
...rest,
});
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/indexer/queryCTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function queryCTypes() {
creator,
block: registrationBlock.id,
...rest,
attestationsCreated,
attestationsCreated, // problem here

Check failure on line 81 in src/utilities/indexer/queryCTypes.ts

View workflow job for this annotation

GitHub Actions / build

Object literal may only specify known properties, and 'attestationsCreated' does not exist in type 'Optional<CTypeDataInput, NullishPropertiesOf<CTypeDataInput>>'.
});
logger.info(
`Added new CType to data base: ${JSON.stringify(newCType, null, 2)}`,
Expand Down

0 comments on commit ffc107b

Please sign in to comment.