mirror of
https://github.com/nocobase/nocobase
synced 2024-11-14 22:27:40 +00:00
Merge branch 'main' into next
This commit is contained in:
commit
fdee3f0afe
@ -12,6 +12,7 @@ const TYPE_TO_ACTION = {
|
|||||||
belongsTo: 'get',
|
belongsTo: 'get',
|
||||||
hasOne: 'get',
|
hasOne: 'get',
|
||||||
belongsToMany: 'list?pageSize=9999',
|
belongsToMany: 'list?pageSize=9999',
|
||||||
|
belongsToArray: 'get',
|
||||||
};
|
};
|
||||||
export const getAction = (type: string) => {
|
export const getAction = (type: string) => {
|
||||||
if (process.env.NODE_ENV !== 'production' && !(type in TYPE_TO_ACTION)) {
|
if (process.env.NODE_ENV !== 'production' && !(type in TYPE_TO_ACTION)) {
|
||||||
|
@ -16,6 +16,11 @@ function escapeLike(value: string) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
$includes(value, ctx) {
|
$includes(value, ctx) {
|
||||||
|
if (value === null) {
|
||||||
|
return {
|
||||||
|
[Op.is]: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
const conditions = value.map((item) => ({
|
const conditions = value.map((item) => ({
|
||||||
[isPg(ctx) ? Op.iLike : Op.like]: `%${escapeLike(item)}%`,
|
[isPg(ctx) ? Op.iLike : Op.like]: `%${escapeLike(item)}%`,
|
||||||
@ -32,6 +37,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
$notIncludes(value, ctx) {
|
$notIncludes(value, ctx) {
|
||||||
|
if (value === null) {
|
||||||
|
return {
|
||||||
|
[Op.not]: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
const conditions = value.map((item) => ({
|
const conditions = value.map((item) => ({
|
||||||
[isPg(ctx) ? Op.notILike : Op.notLike]: `%${escapeLike(item)}%`,
|
[isPg(ctx) ? Op.notILike : Op.notLike]: `%${escapeLike(item)}%`,
|
||||||
|
Loading…
Reference in New Issue
Block a user