mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-08-28 11:46:02 +08:00
Adds new inverse rule operators (#594)
This commit is contained in:
parent
394504a023
commit
616fcf727a
5 changed files with 9 additions and 3 deletions
|
@ -84,7 +84,7 @@ export const getListUsers = async (id: number, params: PageParams, projectId: nu
|
|||
.where('list_id', id)
|
||||
.select('users.*', 'user_list.created_at', 'user_list.id', 'user_list.user_id'),
|
||||
App.main.db,
|
||||
(item) => ({ ...item, id: item.user_id }) as any,
|
||||
(item) => User.fromJson({ ...item, id: item.user_id }) as any,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Model, { ModelParams } from '../core/Model'
|
||||
|
||||
export type Operator = '=' | '!=' | '<' |'<=' | '>' | '>=' | '=' | 'is set' | 'is not set' | 'or' | 'and' | 'xor' | 'empty' | 'contains' | 'starts with' | 'ends with' | 'any' | 'none'
|
||||
export type Operator = '=' | '!=' | '<' |'<=' | '>' | '>=' | '=' | 'is set' | 'is not set' | 'or' | 'and' | 'xor' | 'empty' | 'contains' | 'not contain' | 'starts with' | 'not start with' | 'ends with' | 'any' | 'none'
|
||||
export type RuleType = 'wrapper' | 'string' | 'number' | 'boolean' | 'date' | 'array'
|
||||
export type RuleGroup = 'user' | 'event' | 'parent'
|
||||
|
||||
|
|
|
@ -33,10 +33,14 @@ export default {
|
|||
return v !== ruleValue
|
||||
case 'starts with':
|
||||
return v?.startsWith(ruleValue)
|
||||
case 'not start with':
|
||||
return !v?.startsWith(ruleValue)
|
||||
case 'ends with':
|
||||
return v?.endsWith(ruleValue)
|
||||
case 'contains':
|
||||
return v?.includes(ruleValue)
|
||||
case 'not contain':
|
||||
return !v?.includes(ruleValue)
|
||||
default:
|
||||
throw new RuleEvalException(rule, 'unknown operator: ' + rule.operator)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ export interface OAuthResponse {
|
|||
refresh_expires_at: Date
|
||||
}
|
||||
|
||||
export type Operator = '=' | '!=' | '<' | '<=' | '>' | '>=' | '=' | 'is set' | 'is not set' | 'or' | 'and' | 'xor' | 'empty' | 'contains' | 'starts with' | 'any' | 'none'
|
||||
export type Operator = '=' | '!=' | '<' | '<=' | '>' | '>=' | '=' | 'is set' | 'is not set' | 'or' | 'and' | 'xor' | 'empty' | 'contains' | 'not contain' | 'starts with' | 'not start with' | 'any' | 'none'
|
||||
export type RuleType = 'wrapper' | 'string' | 'number' | 'boolean' | 'date' | 'array'
|
||||
export type RuleGroup = 'user' | 'event' | 'parent'
|
||||
|
||||
|
|
|
@ -64,7 +64,9 @@ const operatorTypes: Record<RuleType, OperatorOption[]> = {
|
|||
...baseOperators,
|
||||
{ key: 'empty', label: 'is empty' },
|
||||
{ key: 'contains', label: 'contains' },
|
||||
{ key: 'not contain', label: 'does not contain' },
|
||||
{ key: 'starts with', label: 'starts with' },
|
||||
{ key: 'not start with', label: 'does not start with' },
|
||||
],
|
||||
number: [
|
||||
...baseOperators,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue