File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint @typescript-eslint/explicit-module-boundary-types: 0 */
2
+ try {
3
+ const pg = require ( 'pg' ) ;
4
+ pg . types . setTypeParser ( 20 , 'text' , parseInt ) ;
5
+ } catch ( err ) {
6
+ logger . info ( 'There is no pg' ) ;
7
+ }
2
8
import { config } from './config' ;
3
9
import { parse } from 'url' ;
4
10
import { Knex } from 'knex' ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export async function sub(
32
32
}
33
33
} else {
34
34
await db . transaction ( async ( trx ) => {
35
- const [ feed_id ] = await db ( 'rss_feed' )
35
+ let [ feed_id ] = await db ( 'rss_feed' )
36
36
. insert (
37
37
{
38
38
url : feedUrl ,
@@ -41,7 +41,11 @@ export async function sub(
41
41
} ,
42
42
'feed_id'
43
43
)
44
+ . returning ( 'feed_id' )
44
45
. transacting ( trx ) ;
46
+ if ( typeof feed_id === 'object' ) {
47
+ feed_id = feed_id . feed_id ; // pg return object
48
+ }
45
49
await db ( 'subscribes' )
46
50
. insert ( { feed_id, user_id : userId } , 'subscribe_id' )
47
51
. transacting ( trx ) ;
You can’t perform that action at this time.
0 commit comments