@better-giving/endowment 4.0.35 → 4.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db.d.mts +1 -0
- package/dist/db.mjs +14 -0
- package/package.json +1 -1
- package/src/db.mts +19 -0
package/dist/db.d.mts
CHANGED
|
@@ -145,6 +145,7 @@ export declare class NpoDb extends Db {
|
|
|
145
145
|
npo_programs(id: number): Promise<IProgramDb[]>;
|
|
146
146
|
npo_program_put(npo: number, content: IProgramNew): Promise<string>;
|
|
147
147
|
npo_prog_del_txis(npo: number, prog: string): Promise<TxItems>;
|
|
148
|
+
npo_prog_contrib_update_txi(npo: number, prog: string, amount: number): TxType["Update"];
|
|
148
149
|
npo_prog_del(npo: number, prog: string): Promise<import("@aws-sdk/lib-dynamodb").TransactWriteCommandOutput>;
|
|
149
150
|
npo_prog_update(npo: number, prog: string, update: IProgramUpdate): Promise<Record<string, any> | undefined>;
|
|
150
151
|
}
|
package/dist/db.mjs
CHANGED
|
@@ -402,6 +402,20 @@ export class NpoDb extends Db {
|
|
|
402
402
|
}
|
|
403
403
|
return txs.all;
|
|
404
404
|
}
|
|
405
|
+
npo_prog_contrib_update_txi(npo, prog, amount) {
|
|
406
|
+
return {
|
|
407
|
+
TableName: NpoDb.table,
|
|
408
|
+
Key: this.key_npo_program(prog, npo),
|
|
409
|
+
UpdateExpression: "SET #x = if_not_exists(#x, :zero) + :amt",
|
|
410
|
+
ExpressionAttributeValues: {
|
|
411
|
+
":amt": amount,
|
|
412
|
+
":zero": 0,
|
|
413
|
+
},
|
|
414
|
+
ExpressionAttributeNames: {
|
|
415
|
+
"#x": "totalDonations",
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
405
419
|
async npo_prog_del(npo, prog) {
|
|
406
420
|
const txs = await this.npo_prog_del_txis(npo, prog);
|
|
407
421
|
const cmd = new TransactWriteCommand({
|
package/package.json
CHANGED
package/src/db.mts
CHANGED
|
@@ -514,6 +514,25 @@ export class NpoDb extends Db {
|
|
|
514
514
|
return txs.all;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
npo_prog_contrib_update_txi(
|
|
518
|
+
npo: number,
|
|
519
|
+
prog: string,
|
|
520
|
+
amount: number
|
|
521
|
+
): TxType["Update"] {
|
|
522
|
+
return {
|
|
523
|
+
TableName: NpoDb.table,
|
|
524
|
+
Key: this.key_npo_program(prog, npo),
|
|
525
|
+
UpdateExpression: "SET #x = if_not_exists(#x, :zero) + :amt",
|
|
526
|
+
ExpressionAttributeValues: {
|
|
527
|
+
":amt": amount,
|
|
528
|
+
":zero": 0,
|
|
529
|
+
},
|
|
530
|
+
ExpressionAttributeNames: {
|
|
531
|
+
"#x": "totalDonations" satisfies keyof IProgram,
|
|
532
|
+
},
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
|
|
517
536
|
async npo_prog_del(npo: number, prog: string) {
|
|
518
537
|
const txs = await this.npo_prog_del_txis(npo, prog);
|
|
519
538
|
const cmd = new TransactWriteCommand({
|