Streamline nameing to "user codecheck" for debug
This commit is contained in:
parent
0885209502
commit
744ab40a6b
@ -3,14 +3,14 @@ import db, { handlePrismaError } from '../../../handlers/db.js'; // Database
|
|||||||
import log from '../../../handlers/log.js';
|
import log from '../../../handlers/log.js';
|
||||||
import { schema_get } from './user_codecheck_schema.js';
|
import { schema_get } from './user_codecheck_schema.js';
|
||||||
|
|
||||||
// MARK: GET check user code
|
// MARK: GET user codecheck
|
||||||
async function get(req: Request, res: Response) {
|
async function get(req: Request, res: Response) {
|
||||||
const { error, value } = schema_get.validate(req.query);
|
const { error, value } = schema_get.validate(req.query);
|
||||||
if (error) {
|
if (error) {
|
||||||
log.api?.debug('GET check user code Error:', req.query, value, error.details[0].message);
|
log.api?.debug('GET user codecheck Error:', req.query, value, error.details[0].message);
|
||||||
res.status(400).json({ status: 'ERROR', errorcode: 'VALIDATION_ERROR', message: error.details[0].message });
|
res.status(400).json({ status: 'ERROR', errorcode: 'VALIDATION_ERROR', message: error.details[0].message });
|
||||||
} else {
|
} else {
|
||||||
log.api?.debug('GET check user code Success:', req.query, value);
|
log.api?.debug('GET user codecheck Success:', req.query, value);
|
||||||
|
|
||||||
await db.user
|
await db.user
|
||||||
.findUnique({
|
.findUnique({
|
||||||
@ -19,7 +19,7 @@ async function get(req: Request, res: Response) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
handlePrismaError(err, res, 'GET check user code');
|
handlePrismaError(err, res, 'GET user codecheck');
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
// user has no code OR code must match
|
// user has no code OR code must match
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import validator from 'joi'; // DOCS: https://joi.dev/api
|
import validator from 'joi'; // DOCS: https://joi.dev/api
|
||||||
|
|
||||||
// MARK: GET check user code
|
// MARK: GET user codecheck
|
||||||
const schema_get = validator.object({
|
const schema_get = validator.object({
|
||||||
id: validator.number().positive().precision(0).required(),
|
id: validator.number().positive().precision(0).required(),
|
||||||
code: validator
|
code: validator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user