Skip to content

Commit

Permalink
Merge pull request #65 from Giveth/revoked-url-change
Browse files Browse the repository at this point in the history
Removed revoked attestations + change slug to url
  • Loading branch information
aminlatifi authored Jun 6, 2024
2 parents 058a791 + 325b2d0 commit d739559
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 77 deletions.
13 changes: 0 additions & 13 deletions db/migrations/1716207083370-Data.js

This file was deleted.

11 changes: 0 additions & 11 deletions db/migrations/1717657836767-Data.js

This file was deleted.

21 changes: 0 additions & 21 deletions db/migrations/1717658264897-Data.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ type ProjectAttestation @entity {
recipient: String!
vouch: Boolean!
txHash: String!
revoked: Boolean!
attestorOrganisation: AttestorOrganisation!
project: Project!
attestTimestamp: DateTime!
Expand All @@ -18,7 +17,6 @@ type AttestorOrganisation @entity {
organisation: Organisation!
"Timestamp at which the relationship was created"
attestTimestamp: DateTime!
revoked: Boolean!
}

type Attestor @entity {
Expand Down Expand Up @@ -60,7 +58,7 @@ type Project @entity {
"Total attests"
totalAttests: Int!
"Slug of the project"
slug: String
url: String
"Image of the project"
image: String
"project data is imported from a source or not"
Expand Down
4 changes: 1 addition & 3 deletions src/controllers/authorizeAttestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const handleAuthorize = async (
id: key,
attestor,
organisation,
revoked: false,
attestTimestamp: new Date(log.block.timestamp),
});

Expand All @@ -66,7 +65,6 @@ export const handleAuthorizeRevoke = async (
return;
}

attestation.revoked = true;
await ctx.store.upsert(attestation);
await ctx.store.remove(attestation);
ctx.log.debug(`Revoked authorize attestation ${attestation}`);
};
11 changes: 1 addition & 10 deletions src/controllers/projectVerificationAttestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ export const handleProjectAttestation = async (
return;
}

if (attestorOrganisation.revoked) {
ctx.log.debug(
`Attestor ${issuer} authorization attestation ${refUID} is revoked from organisation ${attestorOrganisation.organisation.name}`
);
return;
}

const { success, data: projectVerificationAttestation } =
parseAttestationData(decodedData);

Expand Down Expand Up @@ -93,7 +86,6 @@ export const handleProjectAttestation = async (
attestorOrganisation,
comment,
attestTimestamp: new Date(log.block.timestamp),
revoked: false,
recipient,
});

Expand Down Expand Up @@ -124,8 +116,7 @@ export const handleProjectAttestationRevoke = async (
return;
}

attestation.revoked = true;
await ctx.store.upsert(attestation);
await ctx.store.remove(attestation);
ctx.log.debug(`Revoked project attestation ${JSON.stringify(attestation)}`);

await updateProjectAttestationCounts(ctx, attestation.project);
Expand Down
2 changes: 1 addition & 1 deletion src/features/import-projects/gitcoin/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const processProjectsBatch = async (
id: project.id,
title: project.name || project.metadata?.title,
description: project.metadata?.description,
slug: generateGitcoinSlug(project),
url: generateGitcoinSlug(project),
image: project.metadata?.bannerImg
? convertIpfsHashToHttps(project.metadata?.bannerImg)
: "",
Expand Down
6 changes: 3 additions & 3 deletions src/features/import-projects/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const updateOrCreateProject = async (
const isUpdated =
existingProject.title !== project[titleField] ||
existingProject.description !== project[descriptionField] ||
existingProject.slug !== project[slugField] ||
existingProject.url !== project[slugField] ||
existingProject.image !== project[imageField];

if (isUpdated) {
Expand All @@ -45,7 +45,7 @@ export const updateOrCreateProject = async (
title: project[titleField],
description: project[descriptionField],
image: project[imageField],
slug: project[slugField],
url: project[slugField],
lastUpdatedTimestamp: new Date(),
imported: true,
});
Expand All @@ -67,7 +67,7 @@ export const updateOrCreateProject = async (
title: project[titleField],
description: project[descriptionField],
image: project[imageField],
slug: project[slugField],
url: project[slugField],
projectId: projectId,
source: source,
totalVouches: 0,
Expand Down
3 changes: 0 additions & 3 deletions src/model/generated/attestorOrganisation.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ export class AttestorOrganisation {
*/
@Column_("timestamp with time zone", {nullable: false})
attestTimestamp!: Date

@Column_("bool", {nullable: false})
revoked!: boolean
}
2 changes: 1 addition & 1 deletion src/model/generated/project.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Project {
* Slug of the project
*/
@Column_("text", {nullable: true})
slug!: string | undefined | null
url!: string | undefined | null

/**
* Image of the project
Expand Down
3 changes: 0 additions & 3 deletions src/model/generated/projectAttestation.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export class ProjectAttestation {
@Column_("text", {nullable: false})
txHash!: string

@Column_("bool", {nullable: false})
revoked!: boolean

@Index_()
@ManyToOne_(() => AttestorOrganisation, {nullable: true})
attestorOrganisation!: AttestorOrganisation
Expand Down

0 comments on commit d739559

Please sign in to comment.