From e4543457e2ff269be5e972b990746b9ad173ab29 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 9 Mar 2024 19:37:14 -0700 Subject: [PATCH] add image onto give claim, then display on feel (full round-trip, baby!) --- project.task.yaml | 12 +++--------- src/libs/endorserServer.ts | 10 +++++++++- src/views/GiftedDetails.vue | 1 + src/views/GiftedPhoto.vue | 4 ++-- src/views/HomeView.vue | 7 +++++++ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index d1b568963..0d9f47d32 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -14,16 +14,10 @@ tasks : - .2 list the "show more" contacts alphabetically - 32 image on give : - - Show a camera to take a picture - - Scale the image to a reasonable size - - Upload to a public readable place - - check the rate limits - - use CID (hash?) - - put the image URL in the claim - - Rates - images erased? - - image not associated with JWT ULID since that's assigned later - - remove previous image - send image type (eg. portrait, give, project) + - upload to a public readable place at correct hosting location + - remove previous image when editing + - on gift details, if project then show, otherwise mark "gift for you" - ask to detect location & record it in settings - if personal location is set, show potential local affiliations diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index ad508c096..f0e7bbdc3 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -67,6 +67,7 @@ export const BLANK_GENERIC_SERVER_RECORD: GenericServerRecord = { issuer: "", }; +// a summary record; the VC is found the fullClaim field export interface GiveServerRecord { agentDid: string; amount: number; @@ -81,6 +82,7 @@ export interface GiveServerRecord { unit: string; } +// a summary record; the VC is found the fullClaim field export interface OfferServerRecord { amount: number; amountGiven: number; @@ -98,13 +100,14 @@ export interface OfferServerRecord { validThrough: string; } +// a summary record; the VC is not currently part of this record export interface PlanServerRecord { agentDid?: string; // optional, if the issuer wants someone else to manage as well description: string; endTime?: string; fulfillsPlanHandleId: string; - issuerDid: string; handleId: string; + issuerDid: string; locLat?: number; locLon?: number; startTime?: string; @@ -120,6 +123,7 @@ export interface GiveVerifiableCredential { description?: string; fulfills?: { "@type": string; identifier?: string; lastClaimId?: string }[]; identifier?: string; + image?: string; object?: { amountOfThisGood: number; unitCode: string }; recipient?: { identifier: string }; } @@ -434,6 +438,7 @@ export async function createAndSubmitGive( fulfillsProjectHandleId?: string, fulfillsOfferHandleId?: string, isTrade: boolean = false, + imageUrl?: string, ): Promise { const vcClaim: GiveVerifiableCredential = { "@context": "https://schema.org", @@ -460,6 +465,9 @@ export async function createAndSubmitGive( identifier: fulfillsOfferHandleId, }); } + if (imageUrl) { + vcClaim.image = imageUrl; + } return createAndSubmitClaim( vcClaim as GenericServerRecord, identity, diff --git a/src/views/GiftedDetails.vue b/src/views/GiftedDetails.vue index 008ebbd74..463a3f93f 100644 --- a/src/views/GiftedDetails.vue +++ b/src/views/GiftedDetails.vue @@ -302,6 +302,7 @@ export default class GiftedDetails extends Vue { this.projectId, this.offerId, this.isTrade, + this.imageUrl, ); if ( diff --git a/src/views/GiftedPhoto.vue b/src/views/GiftedPhoto.vue index df4989ae3..691781e1c 100644 --- a/src/views/GiftedPhoto.vue +++ b/src/views/GiftedPhoto.vue @@ -25,8 +25,7 @@
- -
+
+