Skip to content

Commit 30e3991

Browse files
committed
do not store nostr zap note as scalar
1 parent 1eb1239 commit 30e3991

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

api/payIn/types/proxyPayment.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,18 @@ export async function getInitial (models, { msats, description, descriptionHash,
4242
}
4343

4444
export async function onBegin (tx, payInId, { comment, lud18Data, noteStr }) {
45+
let note = null
46+
if (noteStr) {
47+
try {
48+
note = JSON.parse(noteStr)
49+
} catch (e) {
50+
console.error('invalid noteStr', noteStr)
51+
}
52+
}
53+
4554
const data = {
4655
...(lud18Data && { lud18Data: { create: lud18Data } }),
47-
...(noteStr && { nostrNote: { create: { note: noteStr } } }),
56+
...(note && { nostrNote: { create: { note } } }),
4857
...(comment && { comment: { create: { comment } } })
4958
}
5059

api/resolvers/notifications.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,14 @@ export default {
219219
}
220220

221221
if (meFull.noteDeposits) {
222+
// NOTE: for historical reasons we need to join the payInBolt11 table to make sure
223+
// the payInBolt11 record exists for the payIn
222224
queries.push(
223225
`(SELECT "PayIn".id::text, "PayIn"."payInStateChangedAt" AS "sortTime",
224226
COALESCE(FLOOR("PayIn"."mcost" / 1000), 0) as "earnedSats",
225227
'PayInification' AS type
226228
FROM "PayIn"
229+
JOIN "PayInBolt11" ON "PayInBolt11"."payInId" = "PayIn".id
227230
WHERE "PayIn"."userId" = $1
228231
AND "PayIn"."payInState" = 'PAID'
229232
AND "PayIn"."payInStateChangedAt" < $2

0 commit comments

Comments
 (0)