Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
feat: add groups
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielPadureanu committed Apr 18, 2023
1 parent 795c386 commit ccb6e9c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/routes/measurement-threshold/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TableQuery, EffectiveTableQuery, tableQuerySchemaGenerator } from '../.
import { Quantity } from '../../models/quantity';
import { schema as stringOrTranslations } from '../../models/string-or-translations';
import { schema as thresholdSchema, Threshold } from '../../models/threshold';
import { Grid } from '../../models/grid';

interface Query extends TableQuery {
type?: 'quantity' | 'port';
Expand All @@ -30,7 +31,9 @@ interface ResponseRow {
pinGroup: Pick<PinGroup, 'name' | 'hashId'>;
pin: Pick<Pin, 'name' | 'hashId'>;
edge: Pick<Edge, 'name' | 'hashId'> | null;
} | null;
} | null;
pinGroupGrid: Pick<Grid, 'name' | 'hashId'> | null;
pinGrid: Pick<Grid, 'name' | 'hashId'> | null;
threshold: Threshold;
}

Expand All @@ -42,7 +45,7 @@ interface Response {
const controllerGeneratorOptions: ControllerGeneratorOptionsWithClient = {
method: 'get',
path: '/',
query: tableQuerySchemaGenerator(Joi.string().valid('quantityName', 'pinGroupName').default('quantityName')).keys({
query: tableQuerySchemaGenerator(Joi.string().valid('quantityName', 'pinGroupName', 'pinGroupGridName', 'pinGridName').default('quantityName')).keys({
type: Joi.string().valid('quantity', 'port'),
}),
right: { environment: 'THRESHOLDS' },
Expand Down Expand Up @@ -71,6 +74,14 @@ const controllerGeneratorOptions: ControllerGeneratorOptionsWithClient = {
hashId: Joi.string().required().example('ka08d'),
}).allow(null),
}).allow(null),
pinGroupGrid: Joi.object().keys({
name: Joi.string().required().example('My location group'),
hashId: Joi.string().required().example('naud51'),
}).allow(null),
pinGrid: Joi.object().keys({
name: Joi.string().required().example('My port group'),
hashId: Joi.string().required().example('naud51'),
}).allow(null),
threshold: thresholdSchema.required(),
})).required(),
}),
Expand Down

0 comments on commit ccb6e9c

Please sign in to comment.