mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 16:27:22 +00:00
Fix queries for $in: [null, ...etc] in pg (#7253)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
44e55f3f61
commit
1526ae2055
@ -1137,7 +1137,16 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
|||||||
case '$in':
|
case '$in':
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'common':
|
case 'common':
|
||||||
res.push(`${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`)
|
if (Array.isArray(val) && val.includes(null)) {
|
||||||
|
res.push(
|
||||||
|
`(${tkey} IN (${val
|
||||||
|
.filter((it) => it != null)
|
||||||
|
.map((v: any) => `'${v}'`)
|
||||||
|
.join(', ')}) OR ${tkey} IS NULL)`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
res.push(`${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'array':
|
case 'array':
|
||||||
res.push(`${tkey} && array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`)
|
res.push(`${tkey} && array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`)
|
||||||
@ -1148,7 +1157,14 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case '$nin':
|
case '$nin':
|
||||||
if (val.length > 0) {
|
if (Array.isArray(val) && val.includes(null)) {
|
||||||
|
res.push(
|
||||||
|
`(${tkey} NOT IN (${val
|
||||||
|
.filter((it) => it != null)
|
||||||
|
.map((v: any) => `'${v}'`)
|
||||||
|
.join(', ')}) AND ${tkey} IS NOT NULL)`
|
||||||
|
)
|
||||||
|
} else if (val.length > 0) {
|
||||||
res.push(`${tkey} NOT IN (${val.map((v: any) => `'${v}'`).join(', ')})`)
|
res.push(`${tkey} NOT IN (${val.map((v: any) => `'${v}'`).join(', ')})`)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
6
services/github/pod-github/src/sync/configuration.ts
Normal file
6
services/github/pod-github/src/sync/configuration.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export const githubConfiguration = {
|
||||||
|
ResolveThreadSupported: false
|
||||||
|
}
|
@ -41,6 +41,7 @@ import { Analytics } from '@hcengineering/analytics'
|
|||||||
import { PullRequestReviewThreadEvent } from '@octokit/webhooks-types'
|
import { PullRequestReviewThreadEvent } from '@octokit/webhooks-types'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { syncConfig } from './syncConfig'
|
import { syncConfig } from './syncConfig'
|
||||||
|
import { githubConfiguration } from './configuration'
|
||||||
|
|
||||||
export type ReviewThreadData = Pick<
|
export type ReviewThreadData = Pick<
|
||||||
GithubReviewThread,
|
GithubReviewThread,
|
||||||
@ -362,7 +363,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
|||||||
|
|
||||||
if (Object.keys(platformUpdate).length > 0) {
|
if (Object.keys(platformUpdate).length > 0) {
|
||||||
// Check and update external
|
// Check and update external
|
||||||
if (platformUpdate.isResolved !== undefined) {
|
if (platformUpdate.isResolved !== undefined && githubConfiguration.ResolveThreadSupported) {
|
||||||
const okit = (await this.provider.getOctokit(account as Ref<PersonAccount>)) ?? container.container.octokit
|
const okit = (await this.provider.getOctokit(account as Ref<PersonAccount>)) ?? container.container.octokit
|
||||||
const q = `mutation updateReviewThread($threadID: ID!) {
|
const q = `mutation updateReviewThread($threadID: ID!) {
|
||||||
${platformUpdate.isResolved ? 'resolveReviewThread' : 'unresolveReviewThread'} (
|
${platformUpdate.isResolved ? 'resolveReviewThread' : 'unresolveReviewThread'} (
|
||||||
|
Loading…
Reference in New Issue
Block a user