Skip to content

Commit

Permalink
Make new attribute optional for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
patnorris authored and patnorris committed Feb 25, 2024
1 parent c017e78 commit 0234312
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion backend/donation_tracker_canister/src/Main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ actor class DonationTracker(_donation_canister_id : Text) {
donor : Types.DonorType = newDonor;
personalNote : ?Text = donationInput.personalNote; // Optional field for personal note from donor to recipient
rewardsHaveBeenClaimed : Bool = false;
hasBeenDistributed : Bool = false; // TODO: placeholder for future functionality
hasBeenDistributed : ?Bool = ?false; // TODO: placeholder for future functionality
};

let newDonationResult = donations.add(newDonation);
Expand Down
2 changes: 1 addition & 1 deletion backend/donation_tracker_canister/src/Types.mo
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module Types {
donor : DonorType;
personalNote : ?Text; // Optional field for personal note from donor to recipient
rewardsHaveBeenClaimed : Bool;
hasBeenDistributed : Bool; // TODO: placeholder for future functionality
hasBeenDistributed : ?Bool; // TODO: placeholder for future functionality
};

//-------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ type Donation =
allocation: DonationCategories;
donor: DonorType;
dti: DTI;
hasBeenDistributed: bool;
hasBeenDistributed: opt bool;
paymentTransactionId: PaymentTransactionId;
paymentType: PaymentType;
personalNote: opt text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Principal } from '@dfinity/principal';
import type { ActorMethod } from '@dfinity/agent';
import type { IDL } from '@dfinity/candid';

export type ApiError = { 'InvalidId' : null } |
{ 'ZeroAddress' : null } |
Expand Down Expand Up @@ -28,7 +27,7 @@ export interface Donation {
'dti' : DTI,
'rewardsHaveBeenClaimed' : boolean,
'paymentTransactionId' : PaymentTransactionId,
'hasBeenDistributed' : boolean,
'hasBeenDistributed' : [] | [boolean],
'totalAmount' : Satoshi,
'timestamp' : bigint,
'paymentType' : PaymentType,
Expand Down Expand Up @@ -183,5 +182,3 @@ export interface Utxo {
'outpoint' : OutPoint,
}
export interface _SERVICE extends DonationTracker {}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const idlFactory = ({ IDL }) => {
'dti' : DTI,
'rewardsHaveBeenClaimed' : IDL.Bool,
'paymentTransactionId' : PaymentTransactionId,
'hasBeenDistributed' : IDL.Bool,
'hasBeenDistributed' : IDL.Opt(IDL.Bool),
'totalAmount' : Satoshi,
'timestamp' : IDL.Nat64,
'paymentType' : PaymentType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ export const createActor = (canisterId, options = {}) => {
});
};

export const donation_tracker_canister = canisterId ? createActor(canisterId) : undefined;
export const donation_tracker_canister = createActor(canisterId);

0 comments on commit 0234312

Please sign in to comment.