Skip to content

Commit

Permalink
Revert "try: to make attestationsCreated optional on creation"
Browse files Browse the repository at this point in the history
This reverts commit ffc107b.
  • Loading branch information
kilted-andres committed Aug 12, 2024
1 parent ffc107b commit 21a96db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/models/ctype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ 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: 3 additions & 1 deletion src/pages/ctype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ 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, description, tags } =
const { cType, creator, attestationsCreated, description, tags } =
await getRequestJson<Input>(request);

if (!CType.isICType(cType)) {
Expand Down Expand Up @@ -52,6 +53,7 @@ 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, // problem here
attestationsCreated,
});
logger.info(
`Added new CType to data base: ${JSON.stringify(newCType, null, 2)}`,
Expand Down

0 comments on commit 21a96db

Please sign in to comment.