Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Oct 9, 2024
1 parent 32aaa3b commit 01efc51
Show file tree
Hide file tree
Showing 45 changed files with 1,336 additions and 1,219 deletions.
6 changes: 3 additions & 3 deletions handlers/licences-post/doAddTransaction.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
import { type AddTransactionForm } from '../../helpers/licencesDB/addTransaction.js';
export default function handler(request: Request<unknown, unknown, AddTransactionForm>, response: Response): void;
9 changes: 4 additions & 5 deletions handlers/licences-post/doAddTransaction.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { addTransaction } from "../../helpers/licencesDB/addTransaction.js";
export const handler = (request, response) => {
import addTransaction from '../../helpers/licencesDB/addTransaction.js';
export default function handler(request, response) {
const newTransactionIndex = addTransaction(request.body, request.session);
response.json({
success: true,
message: "Transaction Added Successfully",
message: 'Transaction Added Successfully',
transactionIndex: newTransactionIndex
});
};
export default handler;
}
24 changes: 12 additions & 12 deletions handlers/licences-post/doAddTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { RequestHandler } from "express";
import type { Request, Response } from 'express'

import { addTransaction } from "../../helpers/licencesDB/addTransaction.js";
import addTransaction, {
type AddTransactionForm
} from '../../helpers/licencesDB/addTransaction.js'


export const handler: RequestHandler = (request, response) => {

const newTransactionIndex = addTransaction(request.body, request.session);
export default function handler(
request: Request<unknown, unknown, AddTransactionForm>,
response: Response
): void {
const newTransactionIndex = addTransaction(request.body, request.session)

response.json({
success: true,
message: "Transaction Added Successfully",
message: 'Transaction Added Successfully',
transactionIndex: newTransactionIndex
});
};


export default handler;
})
}
10 changes: 7 additions & 3 deletions handlers/licences-post/doDelete.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
export default function handler(request: Request<unknown, unknown, {
licenceID: string;
}>, response: Response<{
success: boolean;
message: string;
}>): void;
15 changes: 7 additions & 8 deletions handlers/licences-post/doDelete.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { deleteLicence } from "../../helpers/licencesDB/deleteLicence.js";
export const handler = (request, response) => {
if (request.body.licenceID === "") {
import deleteLicence from '../../helpers/licencesDB/deleteLicence.js';
export default function handler(request, response) {
if (request.body.licenceID === '') {
response.json({
success: false,
message: "Licence ID Unavailable"
message: 'Licence ID Unavailable'
});
}
else {
const changeCount = deleteLicence(request.body.licenceID, request.session);
if (changeCount) {
response.json({
success: true,
message: "Licence Deleted"
message: 'Licence Deleted'
});
}
else {
response.json({
success: false,
message: "Licence Not Deleted"
message: 'Licence Not Deleted'
});
}
}
};
export default handler;
}
38 changes: 15 additions & 23 deletions handlers/licences-post/doDelete.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
import type { RequestHandler } from "express";
import type { Request, Response } from 'express'

import { deleteLicence } from "../../helpers/licencesDB/deleteLicence.js";


export const handler: RequestHandler = (request, response) => {

if (request.body.licenceID === "") {
import deleteLicence from '../../helpers/licencesDB/deleteLicence.js'

export default function handler(
request: Request<unknown, unknown, { licenceID: string }>,
response: Response<{ success: boolean; message: string }>
): void {
if (request.body.licenceID === '') {
response.json({
success: false,
message: "Licence ID Unavailable"
});

message: 'Licence ID Unavailable'
})
} else {

const changeCount = deleteLicence(request.body.licenceID, request.session);
const changeCount = deleteLicence(request.body.licenceID, request.session)

if (changeCount) {

response.json({
success: true,
message: "Licence Deleted"
});

message: 'Licence Deleted'
})
} else {

response.json({
success: false,
message: "Licence Not Deleted"
});
message: 'Licence Not Deleted'
})
}
}
};


export default handler;
}
7 changes: 4 additions & 3 deletions handlers/licences-post/doGetDistinctTermsConditions.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
export default function handler(request: Request<unknown, unknown, {
organizationID: string;
}>, response: Response): void;
7 changes: 3 additions & 4 deletions handlers/licences-post/doGetDistinctTermsConditions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getDistinctTermsConditions } from "../../helpers/licencesDB/getDistinctTermsConditions.js";
export const handler = (request, response) => {
import getDistinctTermsConditions from '../../helpers/licencesDB/getDistinctTermsConditions.js';
export default function handler(request, response) {
const organizationID = request.body.organizationID;
response.json(getDistinctTermsConditions(organizationID));
};
export default handler;
}
21 changes: 9 additions & 12 deletions handlers/licences-post/doGetDistinctTermsConditions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import type { RequestHandler } from "express";
import type { Request, Response } from 'express'

import { getDistinctTermsConditions } from "../../helpers/licencesDB/getDistinctTermsConditions.js";
import getDistinctTermsConditions from '../../helpers/licencesDB/getDistinctTermsConditions.js'

export default function handler(
request: Request<unknown, unknown, { organizationID: string }>,
response: Response
): void {
const organizationID = request.body.organizationID

export const handler: RequestHandler = (request, response) => {

const organizationID = request.body.organizationID;

response.json(getDistinctTermsConditions(organizationID));

};


export default handler;
response.json(getDistinctTermsConditions(organizationID))
}
7 changes: 4 additions & 3 deletions handlers/licences-post/doGetTicketTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
export default function handler(request: Request<unknown, unknown, {
licenceTypeKey: string;
}>, response: Response): void;
13 changes: 6 additions & 7 deletions handlers/licences-post/doGetTicketTypes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import * as configFunctions from "../../helpers/functions.config.js";
export const handler = (request, response) => {
import * as configFunctions from '../../helpers/functions.config.js';
export default function handler(request, response) {
const licenceTypeKey = request.body.licenceTypeKey;
const licenceType = configFunctions.getLicenceType(licenceTypeKey);
if (licenceType) {
response.json(licenceType.ticketTypes || []);
if (licenceType === undefined) {
response.json([]);
}
else {
response.json([]);
response.json(licenceType.ticketTypes ?? []);
}
};
export default handler;
}
29 changes: 12 additions & 17 deletions handlers/licences-post/doGetTicketTypes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import type { RequestHandler } from "express";
import type { Request, Response } from 'express'

import * as configFunctions from "../../helpers/functions.config.js";
import * as configFunctions from '../../helpers/functions.config.js'

export default function handler(
request: Request<unknown, unknown, { licenceTypeKey: string }>,
response: Response
): void {
const licenceTypeKey = request.body.licenceTypeKey

export const handler: RequestHandler = (request, response) => {

const licenceTypeKey = request.body.licenceTypeKey;

const licenceType = configFunctions.getLicenceType(licenceTypeKey);

if (licenceType) {

response.json(licenceType.ticketTypes || []);
const licenceType = configFunctions.getLicenceType(licenceTypeKey)

if (licenceType === undefined) {
response.json([])
} else {

response.json([]);
response.json(licenceType.ticketTypes ?? [])
}
};


export default handler;
}
7 changes: 4 additions & 3 deletions handlers/licences-post/doIssueLicence.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
export default function handler(request: Request<unknown, unknown, {
licenceID: string;
}>, response: Response): void;
11 changes: 5 additions & 6 deletions handlers/licences-post/doIssueLicence.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { issueLicence } from "../../helpers/licencesDB/issueLicence.js";
export const handler = (request, response) => {
import issueLicence from '../../helpers/licencesDB/issueLicence.js';
export default function handler(request, response) {
const success = issueLicence(request.body.licenceID, request.session);
if (success) {
response.json({
success: true,
message: "Licence Issued Successfully"
message: 'Licence Issued Successfully'
});
}
else {
response.json({
success: false,
message: "Licence Not Issued"
message: 'Licence Not Issued'
});
}
};
export default handler;
}
29 changes: 12 additions & 17 deletions handlers/licences-post/doIssueLicence.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import type { RequestHandler } from "express";
import type { Request, Response } from 'express'

import { issueLicence } from "../../helpers/licencesDB/issueLicence.js";
import issueLicence from '../../helpers/licencesDB/issueLicence.js'


export const handler: RequestHandler = (request, response) => {

const success = issueLicence(request.body.licenceID, request.session);
export default function handler(
request: Request<unknown, unknown, { licenceID: string }>,
response: Response
): void {
const success = issueLicence(request.body.licenceID, request.session)

if (success) {

response.json({
success: true,
message: "Licence Issued Successfully"
});

message: 'Licence Issued Successfully'
})
} else {

response.json({
success: false,
message: "Licence Not Issued"
});
message: 'Licence Not Issued'
})
}
};


export default handler;
}
12 changes: 9 additions & 3 deletions handlers/licences-post/doSave.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import type { RequestHandler } from "express";
export declare const handler: RequestHandler;
export default handler;
import type { Request, Response } from 'express';
import { type LotteryLicenceForm } from '../../helpers/licencesDB/updateLicence.js';
export default function handler(request: Request<unknown, unknown, LotteryLicenceForm & {
licenceID: string;
}>, response: Response<{
success: boolean;
licenceID?: number;
message?: string;
}>): void;
15 changes: 7 additions & 8 deletions handlers/licences-post/doSave.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLicence } from "../../helpers/licencesDB/createLicence.js";
import { updateLicence } from "../../helpers/licencesDB/updateLicence.js";
export const handler = (request, response) => {
if (request.body.licenceID === "") {
import createLicence from '../../helpers/licencesDB/createLicence.js';
import updateLicence from '../../helpers/licencesDB/updateLicence.js';
export default function handler(request, response) {
if (request.body.licenceID === '') {
const newLicenceID = createLicence(request.body, request.session);
response.json({
success: true,
Expand All @@ -13,15 +13,14 @@ export const handler = (request, response) => {
if (changeCount) {
response.json({
success: true,
message: "Licence updated successfully."
message: 'Licence updated successfully.'
});
}
else {
response.json({
success: false,
message: "Record Not Saved"
message: 'Record Not Saved'
});
}
}
};
export default handler;
}
Loading

0 comments on commit 01efc51

Please sign in to comment.