Sheet use limited input device auth flow (#782)

* refactor: limited-input-device auth

* refactor: resolve sheet directory from setup

* refactor: extract sheet logic in backend

* refactor: simplify sheet integration

---------

Co-authored-by: cv <34649812+cpvalente@users.noreply.github.com>
Co-authored-by: Carlos Valente <carlosvalente@pm.me>
This commit is contained in:
Alex Christoffer Rasmussen
2024-02-24 11:58:50 +01:00
committed by GitHub
parent fc5338903b
commit 474f1e2177
54 changed files with 1636 additions and 1144 deletions
@@ -1,5 +1,7 @@
import { body, validationResult } from 'express-validator';
import { isAlphanumeric } from 'ontime-utils';
import { Request, Response, NextFunction } from 'express';
import { body, param, validationResult } from 'express-validator';
export const projectSanitiser = [
body('title').optional().isString().trim(),
@@ -18,8 +20,15 @@ export const projectSanitiser = [
];
export const validateCustomField = [
body('label').isString().trim(),
body('type').isString().trim(),
body('label')
.exists()
.isString()
.trim()
.custom((value) => {
return isAlphanumeric(value);
}),
body('type').exists().isString().trim(),
body('colour').exists().isString().trim(),
(req: Request, res: Response, next: NextFunction) => {
const errors = validationResult(req);
@@ -29,9 +38,10 @@ export const validateCustomField = [
];
export const validateEditCustomField = [
body('label').isString().trim(),
body('field.label').optional().isString().trim(),
body('field.type').optional().isString().trim(),
param('label').exists().isString().trim(),
body('label').exists().isString().trim(),
body('type').exists().isString().trim(),
body('colour').exists().isString().trim(),
(req: Request, res: Response, next: NextFunction) => {
const errors = validationResult(req);
@@ -40,9 +50,8 @@ export const validateEditCustomField = [
},
];
export const valdiateDeleteCustomField = [
body('label').isString(),
export const validateDeleteCustomField = [
param('label').exists().isString(),
(req: Request, res: Response, next: NextFunction) => {
const errors = validationResult(req);