chore: add prettier with config and format all files
This commit is contained in:
@@ -6,17 +6,25 @@ export const PUT = withAuth(async (req: NextRequest, { params }) => {
|
||||
const { id } = await params;
|
||||
const body = await req.json();
|
||||
const {
|
||||
title, pos_x, pos_y, width, height,
|
||||
signal_type, chart_type, viz_type,
|
||||
filter_items_regex, y_scale,
|
||||
series_limit, order_by,
|
||||
title,
|
||||
pos_x,
|
||||
pos_y,
|
||||
width,
|
||||
height,
|
||||
signal_type,
|
||||
chart_type,
|
||||
viz_type,
|
||||
filter_items_regex,
|
||||
y_scale,
|
||||
series_limit,
|
||||
order_by,
|
||||
} = body;
|
||||
|
||||
const hasFilterCombinators = 'filter_combinators' in body;
|
||||
const hasFilterItems = 'filter_items' in body;
|
||||
const hasFilterCombinators = 'filter_combinators' in body;
|
||||
const hasFilterItems = 'filter_items' in body;
|
||||
const hasFilterItemsExclude = 'filter_items_exclude' in body;
|
||||
const hasYMin = 'y_min' in body;
|
||||
const hasYMax = 'y_max' in body;
|
||||
const hasYMin = 'y_min' in body;
|
||||
const hasYMax = 'y_max' in body;
|
||||
|
||||
const result = await pool.query(
|
||||
`UPDATE charts SET
|
||||
@@ -40,15 +48,28 @@ export const PUT = withAuth(async (req: NextRequest, { params }) => {
|
||||
WHERE id = $23
|
||||
RETURNING *`,
|
||||
[
|
||||
title, pos_x, pos_y, width, height, signal_type, chart_type, viz_type,
|
||||
hasFilterCombinators, body.filter_combinators ?? null,
|
||||
hasFilterItems, body.filter_items ?? null,
|
||||
hasFilterItemsExclude, body.filter_items_exclude ?? null,
|
||||
title,
|
||||
pos_x,
|
||||
pos_y,
|
||||
width,
|
||||
height,
|
||||
signal_type,
|
||||
chart_type,
|
||||
viz_type,
|
||||
hasFilterCombinators,
|
||||
body.filter_combinators ?? null,
|
||||
hasFilterItems,
|
||||
body.filter_items ?? null,
|
||||
hasFilterItemsExclude,
|
||||
body.filter_items_exclude ?? null,
|
||||
filter_items_regex,
|
||||
hasYMin, body.y_min ?? null,
|
||||
hasYMax, body.y_max ?? null,
|
||||
hasYMin,
|
||||
body.y_min ?? null,
|
||||
hasYMax,
|
||||
body.y_max ?? null,
|
||||
y_scale,
|
||||
series_limit, order_by,
|
||||
series_limit,
|
||||
order_by,
|
||||
id,
|
||||
],
|
||||
);
|
||||
@@ -61,4 +82,4 @@ export const DELETE = withAuth(async (_req: NextRequest, { params }) => {
|
||||
const result = await pool.query('DELETE FROM charts WHERE id = $1', [id]);
|
||||
if (result.rowCount === 0) return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
||||
return NextResponse.json({ ok: true });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user