Skip to content

Commit

Permalink
fitx/rationale-governance-format
Browse files Browse the repository at this point in the history
Rationale - Removed body.references since it will be empty until CC-portal enables that feature
GAP title and abstract is now parsing in compatibility with CIP-0108 (body.title, body.abstract)
  • Loading branch information
BEdev24 authored Sep 11, 2024
1 parent 998fbec commit 80d62e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 0 additions & 2 deletions backend/src/constitution/facade/constitution.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ConstitutionRedisService } from 'src/redis/service/constitution-redis.s
import { ConstitutionResponse } from '../api/response/constitution.response';
import { ConstitutionMapper } from '../mapper/constitution.mapper';
import { ConstitutionDto } from 'src/redis/dto/constitution.dto';
import { ConstitutionService } from '../services/constitution.service';
import { IpfsService } from 'src/ipfs/services/ipfs.service';
import { ConstitutionMetadataResponse } from '../api/response/constitution-metadata.response';
import { ConstitutionIpnsUrlResponse } from '../api/response/constitutio-ipns-url.response';
Expand All @@ -14,7 +13,6 @@ export class ConstitutionFacade {

constructor(
private readonly constitutionRedisService: ConstitutionRedisService,
private readonly constitutionService: ConstitutionService,
private readonly ipfsService: IpfsService,
) {}

Expand Down
7 changes: 5 additions & 2 deletions backend/src/governance/facade/governance.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export class GovernanceFacade {
const response = await this.governanceService.addRationale(rationaleDto);
return GovernanceMapper.rationaleDtoToResponse(response);
}

/**
* Creates a CIP 100 compatible JSON object.
* CIP 100 example:
* https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/example.body.json
**/
private async createRationaleJsonCip100(
rationaleRequest: RationaleRequest,
): Promise<string> {
Expand Down Expand Up @@ -97,7 +101,6 @@ export class GovernanceFacade {
hashAlgorithm: CIP100.hashAlgorithm,
authors: [],
body: {
references: [],
comment: rationaleRequest.content,
},
};
Expand Down
1 change: 0 additions & 1 deletion backend/src/governance/interfaces/icip100.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ interface WitnessContext {
}

interface BodyContent {
references: any[];
comment: string;
}
8 changes: 6 additions & 2 deletions worker-service/src/common/common-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export abstract class CommonService {
}
}

/**
* The response data structure example is located on this link:
* https://github.com/cardano-foundation/CIPs/blob/master/CIP-0108/examples/no-confidence.jsonld
**/
async getGovActionProposalFromUrl(
url: string,
): Promise<Partial<GovActionProposalDto>> {
Expand All @@ -95,8 +99,8 @@ export abstract class CommonService {
const title = jsonData.body?.title;
const abstract = jsonData.body?.abstract;
const govActionProposal: Partial<GovActionProposalDto> = {
title: title?.['@value'],
abstract: abstract?.['@value'],
title: title,
abstract: abstract,
govMetadataUrl: url,
};
return govActionProposal;
Expand Down

0 comments on commit 80d62e9

Please sign in to comment.