forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor: migrate interfaces to dedicated directory
Reorganizes TypeScript interfaces into a modular structure: - Create dedicated interfaces directory with specialized files - Split interfaces by domain (claims, common, limits, records, user) - Update imports in endorserServer.ts to use new interface locations - Replace 'any' types with 'unknown' for better type safety - Add proper type imports and exports This improves code organization and maintainability by: - Centralizing interface definitions - Reducing file size of endorserServer.ts - Making interface relationships more explicit - Improving type safety with stricter types
This commit is contained in:
90
src/interfaces/records.ts
Normal file
90
src/interfaces/records.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { GiveVerifiableCredential, OfferVerifiableCredential } from "./claims";
|
||||
|
||||
// a summary record; the VC is found the fullClaim field
|
||||
export interface GiveSummaryRecord {
|
||||
agentDid: string;
|
||||
amount: number;
|
||||
amountConfirmed: number;
|
||||
description: string;
|
||||
fullClaim: GiveVerifiableCredential;
|
||||
fulfillsHandleId: string;
|
||||
fulfillsPlanHandleId?: string;
|
||||
fulfillsType?: string;
|
||||
handleId: string;
|
||||
issuedAt: string;
|
||||
issuerDid: string;
|
||||
jwtId: string;
|
||||
providerPlanHandleId?: string;
|
||||
recipientDid: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
// a summary record; the VC is found the fullClaim field
|
||||
export interface OfferSummaryRecord {
|
||||
amount: number;
|
||||
amountGiven: number;
|
||||
amountGivenConfirmed: number;
|
||||
fullClaim: OfferVerifiableCredential;
|
||||
fulfillsPlanHandleId: string;
|
||||
handleId: string;
|
||||
issuerDid: string;
|
||||
jwtId: string;
|
||||
nonAmountGivenConfirmed: number;
|
||||
objectDescription: string;
|
||||
offeredByDid: string;
|
||||
recipientDid: string;
|
||||
requirementsMet: boolean;
|
||||
unit: string;
|
||||
validThrough: string;
|
||||
}
|
||||
|
||||
export interface OfferToPlanSummaryRecord extends OfferSummaryRecord {
|
||||
planName: string;
|
||||
}
|
||||
|
||||
// a summary record; the VC is not currently part of this record
|
||||
export interface PlanSummaryRecord {
|
||||
agentDid?: string;
|
||||
description: string;
|
||||
endTime?: string;
|
||||
fulfillsPlanHandleId: string;
|
||||
handleId: string;
|
||||
image?: string;
|
||||
issuerDid: string;
|
||||
locLat?: number;
|
||||
locLon?: number;
|
||||
name?: string;
|
||||
startTime?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents data about a project
|
||||
*
|
||||
* @deprecated
|
||||
* (Maybe we should use PlanSummaryRecord instead, either by adding rowId or by iterating with jwtId.)
|
||||
**/
|
||||
export interface PlanData {
|
||||
/**
|
||||
* Description of the project
|
||||
**/
|
||||
description: string;
|
||||
/**
|
||||
* URL referencing information about the project
|
||||
**/
|
||||
handleId: string;
|
||||
image?: string;
|
||||
/**
|
||||
* The DID of the issuer
|
||||
*/
|
||||
issuerDid: string;
|
||||
/**
|
||||
* Name of the project
|
||||
**/
|
||||
name: string;
|
||||
/**
|
||||
* The identifier of the project record -- different from jwtId
|
||||
* (Maybe we should use the jwtId to iterate through the records instead.)
|
||||
**/
|
||||
rowId?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user