File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11/* 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+ }
28import { config } from './config' ;
39import { parse } from 'url' ;
410import { Knex } from 'knex' ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export async function sub(
3232 }
3333 } else {
3434 await db . transaction ( async ( trx ) => {
35- const [ feed_id ] = await db ( 'rss_feed' )
35+ let [ feed_id ] = await db ( 'rss_feed' )
3636 . insert (
3737 {
3838 url : feedUrl ,
@@ -41,7 +41,11 @@ export async function sub(
4141 } ,
4242 'feed_id'
4343 )
44+ . returning ( 'feed_id' )
4445 . transacting ( trx ) ;
46+ if ( typeof feed_id === 'object' ) {
47+ feed_id = feed_id . feed_id ; // pg return object
48+ }
4549 await db ( 'subscribes' )
4650 . insert ( { feed_id, user_id : userId } , 'subscribe_id' )
4751 . transacting ( trx ) ;
You can’t perform that action at this time.
0 commit comments