change: query update to v1.4.0
This commit is contained in:
parent
5a057af17d
commit
9e41910e9e
2 changed files with 22 additions and 2 deletions
|
@ -1,9 +1,10 @@
|
|||
export interface DynamicQueryStructure {
|
||||
id: string;
|
||||
select: string[] | "*";
|
||||
table: string;
|
||||
where?: Array<ConditionStructure>;
|
||||
join?: Array<DynamicQueryStructure & { foreignColumn: string }>;
|
||||
orderBy?: Array<OrderByStructure>;
|
||||
join?: Array<DynamicQueryStructure & JoinStructure>;
|
||||
orderBy?: Array<OrderByStructure>; // only at top level
|
||||
}
|
||||
|
||||
export type ConditionStructure = (
|
||||
|
@ -47,7 +48,12 @@ export type WhereOperation =
|
|||
| "timespanEq"; // Date before x years (YYYY-01-01 <bis> YYYY-12-31)
|
||||
// TODO: age between | age equals | age greater | age smaller
|
||||
|
||||
export type JoinStructure = { foreignColumn: string; type: "defined" } | { condition: string; type: "custom" };
|
||||
|
||||
export type OrderByStructure = {
|
||||
id: string;
|
||||
depth: number;
|
||||
table: string;
|
||||
column: string;
|
||||
order: OrderByType;
|
||||
};
|
||||
|
@ -59,6 +65,7 @@ export type QueryResult = {
|
|||
};
|
||||
|
||||
export const exampleQuery: DynamicQueryStructure = {
|
||||
id: "1234",
|
||||
select: ["firstname", "lastname"],
|
||||
table: "member",
|
||||
where: [
|
||||
|
@ -92,19 +99,25 @@ export const exampleQuery: DynamicQueryStructure = {
|
|||
],
|
||||
join: [
|
||||
{
|
||||
id: "5678",
|
||||
select: "*",
|
||||
table: "communication",
|
||||
foreignColumn: "sendNewsletter",
|
||||
type: "defined",
|
||||
},
|
||||
{
|
||||
id: "91011",
|
||||
select: "*",
|
||||
table: "membership",
|
||||
foreignColumn: "memberships",
|
||||
type: "defined",
|
||||
join: [
|
||||
{
|
||||
id: "121314",
|
||||
select: "*",
|
||||
table: "membership_status",
|
||||
foreignColumn: "status",
|
||||
type: "defined",
|
||||
where: [
|
||||
{
|
||||
structureType: "condition",
|
||||
|
@ -120,10 +133,16 @@ export const exampleQuery: DynamicQueryStructure = {
|
|||
],
|
||||
orderBy: [
|
||||
{
|
||||
id: "1234",
|
||||
depth: 0,
|
||||
table: "member",
|
||||
column: "firstname",
|
||||
order: "ASC",
|
||||
},
|
||||
{
|
||||
id: "1234",
|
||||
depth: 0,
|
||||
table: "member",
|
||||
column: "lastname",
|
||||
order: "ASC",
|
||||
},
|
||||
|
|
|
@ -5,6 +5,7 @@ export interface QueryViewModel {
|
|||
id: string;
|
||||
title: string;
|
||||
query: string | DynamicQueryStructure;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface CreateQueryViewModel {
|
||||
|
|
Loading…
Add table
Reference in a new issue