@@ -23,35 +23,38 @@ module.exports = (app, payListen, model, auth, ln) => async {
23
23
, setLnurlPayEndpoint, delLnurlPayEndpoint
24
24
} = model
25
25
26
- app . get ( '/endpoints ' , auth , wrap ( async ( req , res ) =>
26
+ app . get ( '/lnurlpays ' , auth , wrap ( async ( req , res ) =>
27
27
res . status ( 200 ) . send (
28
28
( await listLnurlPayEndpoints ( ) )
29
29
. map ( lnurlpay => addBech32Lnurl ( req , lnurlpay ) )
30
30
) ) )
31
31
32
- app . post ( '/endpoint ' , auth , wrap ( async ( req , res ) =>
32
+ app . post ( '/lnurlpay ' , auth , wrap ( async ( req , res ) =>
33
33
res . status ( 201 ) . send (
34
34
addBech32Lnurl ( req , await setLnurlPayEndpoint ( null , req . body ) )
35
35
) ) )
36
36
37
- app . put ( '/endpoint/:id' , auth , wrap ( async ( req , res ) =>
37
+ app . put ( '/lnurlpay/:id' , auth , wrap ( async ( req , res ) => {
38
+ const endpoint = await getLnurlPayEndpoint ( req . params . id )
39
+ const updated = { ...endpoint , ...req . body }
38
40
res . status ( 200 ) . send (
39
- addBech32Lnurl ( req , await setLnurlPayEndpoint ( req . params . id , req . body ) )
40
- ) ) )
41
+ addBech32Lnurl ( req , await setLnurlPayEndpoint ( req . params . id , updated ) )
42
+ )
43
+ } ) )
41
44
42
- app . delete ( '/endpoint /:id' , auth , wrap ( async ( req , res ) => {
45
+ app . delete ( '/lnurlpay /:id' , auth , wrap ( async ( req , res ) => {
43
46
const deletedRows = await delLnurlPayEndpoint ( req . params . id )
44
47
if ( deletedRows ) res . status ( 204 )
45
48
else res . status ( 404 )
46
49
} ) )
47
50
48
- app . get ( '/endpoint /:id' , auth , wrap ( async ( req , res ) => {
51
+ app . get ( '/lnurlpay /:id' , auth , wrap ( async ( req , res ) => {
49
52
const endpoint = await getLnurlPayEndpoint ( req . params . id )
50
53
if ( endpoint ) res . status ( 200 ) . send ( addBech32Lnurl ( req , endpoint ) )
51
54
else res . status ( 404 )
52
55
} ) )
53
56
54
- app . get ( '/endpoint /:id/invoices' , auth , wrap ( async ( req , res ) =>
57
+ app . get ( '/lnurlpay /:id/invoices' , auth , wrap ( async ( req , res ) =>
55
58
res . send ( await listInvoicesByLnurlPayEndpoint ( req . params . id ) ) ) )
56
59
57
60
// this is the actual endpoint users will hit
0 commit comments