@@ -41,7 +41,7 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
4141 [ tenantId ]
4242 )
4343 let count = 0
44- if ( result != null && result . rows ?. length > 0 ) {
44+ if ( result ? .rows ?. length > 0 ) {
4545 count = Number ( result . rows [ 0 ] . total_count )
4646 }
4747 return count
@@ -94,11 +94,10 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
9494 [ accessInfo , tenantId ]
9595 )
9696
97- if ( results ?. rowCount ) {
98- if ( results . rowCount > 0 ) {
99- return results . rows [ 0 ]
100- }
97+ if ( ( results ?. rowCount ?? 0 ) > 0 ) {
98+ return results . rows [ 0 ]
10199 }
100+
102101 return null
103102 }
104103
@@ -116,11 +115,10 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
116115 [ accessInfo , tenantId ]
117116 )
118117
119- if ( results ?. rowCount ) {
120- if ( results . rowCount > 0 ) {
121- return true
122- }
118+ if ( ( results ?. rowCount ?? 0 ) > 0 ) {
119+ return true
123120 }
121+
124122 return false
125123 }
126124
@@ -137,10 +135,8 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
137135 WHERE access_info = $1 and tenant_id = $2` ,
138136 [ accessInfo , tenantId ]
139137 )
140- if ( profiles ?. rowCount ) {
141- if ( profiles . rowCount > 0 ) {
142- throw new RPSError ( NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT ( 'Proxy' , accessInfo ) , 'Foreign key violation' )
143- }
138+ if ( ( profiles ?. rowCount ?? 0 ) > 0 ) {
139+ throw new RPSError ( NETWORK_CONFIG_DELETION_FAILED_CONSTRAINT ( 'Proxy' , accessInfo ) , 'Foreign key violation' )
144140 }
145141 try {
146142 const results = await this . db . query (
@@ -185,11 +181,10 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
185181 proxyConfig . tenantId
186182 ]
187183 )
188- if ( results ?. rowCount ) {
189- if ( results . rowCount > 0 ) {
190- const config = await this . getByName ( proxyConfig . accessInfo , proxyConfig . tenantId )
191- return config
192- }
184+
185+ if ( ( results ?. rowCount ?? 0 ) > 0 ) {
186+ const config = await this . getByName ( proxyConfig . accessInfo , proxyConfig . tenantId )
187+ return config
193188 }
194189 } catch ( error ) {
195190 if ( error . code === PostgresErr . C23_UNIQUE_VIOLATION ) {
@@ -227,10 +222,8 @@ export class ProxyConfigsTable implements IProxyConfigsTable {
227222 )
228223
229224 latestItem = await this . getByName ( proxyConfig . accessInfo , proxyConfig . tenantId )
230- if ( results ?. rowCount ) {
231- if ( results . rowCount > 0 ) {
232- return latestItem
233- }
225+ if ( ( results ?. rowCount ?? 0 ) > 0 ) {
226+ return latestItem
234227 }
235228 } catch ( error ) {
236229 throw new RPSError ( NETWORK_CONFIG_ERROR ( 'Proxy' , proxyConfig . accessInfo ) )
0 commit comments