Attempting to get local and remote repos back in sync

This commit is contained in:
Alan Bridgeman 2025-06-10 08:15:24 -05:00
parent ba3978fffb
commit 1497d2d8dc
47 changed files with 5106 additions and 2539 deletions

View file

@ -0,0 +1,49 @@
import { Request, Response } from 'express';
import { Controller, GET, Page, BaseController } from '@BridgemanAccessible/ba-web-framework';
/**
* The AboutController class is responsible for handling the about page of the site.
*/
@Controller()
export class AboutController extends BaseController {
/**
* Route for rendering the site's about page.
*
* @param req The request object.
* @param res The response object.
*/
@Page('About', 'about.ejs')
@GET('/about')
private about(req: Request, res: Response) {
return {
people: [
{
fname: 'Alan',
lname: 'Bridgeman',
position: 'Proprietor, CEO & Lead Developer',
bio: '' +
'Alan has been an avid disability advocate for over a decade including being a part of or involved with a variety of civic, provincial, national and international organizations around disability or accessibility. ' +
'Alan has held numerous certifications including but not limited to: Mental Health First Aid, Certified Professional in Accessibility Core Competinies (CPACC) with the International Association of Accessibility Professionals (IAAP), among others. ' +
'In additioan to his involvment in the disability community Alan is a dedicated and passionate software developer with a significant amount of experience in the industry. ' +
'He has worked on a wide variety of projects, from small websites for research teams and non-profits to large enterprise applications at fourtune 500 companites like Microsoft. ' +
'He has a strong background in web and cloud development, but has also worked on desktop and mobile applications. He has worked with many different technologies, including C#, Python, JavaScript, TypeScript, React, Node.js, Java, and many more. ' +
'Alan started Bridgeman Accessible because he saw over and over again companies that were lead by non-disabled people and non-developers trying to solve digital accessibility problems. ' +
'Moreover, they would only every consult or give advice but never build or innovate in ways that would help the community and the industry in a meaningful and impactful way.',
image: 'alan.jpeg',
website: 'https://alanbridgeman.ca/',
email: 'alan@alanbridgeman.ca'
},
//{
// fname: 'John',
// lname: 'Oberton',
// position: 'Infrastructure Developer (Project by Project basis/Contract)'
//},
//{
// fname: 'Trevor',
// lname: 'Xie',
// position: 'Designer (Project by Project basis/Contract)'
//}
]
};
}
}

View file

@ -0,0 +1,28 @@
import { Request, Response } from 'express';
import { Controller, GET, Page, BaseController } from '@BridgemanAccessible/ba-web-framework';
/**
* The HomeController class is responsible for handling the home page of the site.
*/
@Controller()
export class HomeController extends BaseController {
/**
* Route for rendering the site's home page.
*
* @param req The request object.
* @param res The response object.
*/
@Page('Home', 'index.ejs')
@GET('/')
private home(req: Request, res: Response) {
return {
business: {
location: 'Winnipeg, Canada'
}
};
}
@Page('New Design', 'new-design-3.ejs', [], ['new-design-3'])
@GET('/new-design')
private newPage(req: Request, res: Response) {}
}

57
src/routes/Newsletter.ts Normal file
View file

@ -0,0 +1,57 @@
import express, { Request, Response } from 'express';
import { Controller, GET, Page, POST, BaseController } from '@BridgemanAccessible/ba-web-framework';
import { APICredentials, Subscriber, List } from '@BridgemanAccessible/listmonk-node-client';
@Controller()
class NewsletterRoutes extends BaseController {
/** Listmonk credentials */
private creds: APICredentials;
constructor() {
super();
// Verify that the required environment variables are set
if(typeof process.env.LISTMONK_HOST === 'undefined') { throw new Error('Missing environment variable: LISTMONK_HOST (hostname of Listmonk instance to use)'); }
if(typeof process.env.LISTMONK_USERNAME === 'undefined') { throw new Error('Missing environment variable: LISTMONK_USERNAME (username to access Listmonk)'); }
if(typeof process.env.LISTMONK_PASSWORD === 'undefined') { throw new Error('Missing environment variable: LISTMONK_PASSWORD (password to access Listmonk)'); }
this.creds = {
host: process.env.LISTMONK_HOST,
username: process.env.LISTMONK_USERNAME,
password: process.env.LISTMONK_PASSWORD
}
}
@POST('/newsletter/signup', express.json())
private async signUp(req: Request, res: Response) {
const email = req.body.email;
const name = req.body.name;
const attribs: { [key: string]: any } = {};
if(typeof req.body.phone !== 'undefined') {
attribs.phone = req.body.phone;
}
try {
// Get the newsletter list
const list = await List.find((list: List) => list.getName() === 'Bridgeman Accessible Newsletter', this.creds);
if(typeof list === 'undefined') {
throw new Error('Newsletter list not found');
}
// Create the subscriber
await (await Subscriber.create(email, name, 'enabled', [list], attribs, false, this.creds)).save();
}
catch(e) {
console.error(e);
res.status(500).send('Issue with signing user up');
return;
}
res.status(200).json({ message: 'Sign up successful' });
}
@Page('Newsletter', 'newsletter.ejs', ['newsletter-signup'])
@GET('/newsletter')
private signupPage(req: Request, res: Response) {}
}

View file

@ -0,0 +1,18 @@
import { Request, Response } from 'express';
import { Controller, GET, Page, BaseController } from '@BridgemanAccessible/ba-web-framework';
/**
* The ProductsController class is responsible for handling the products page of the site.
*/
@Controller()
export class ProductsController extends BaseController {
/**
* Route for rendering the site's products page.
*
* @param req The request object.
* @param res The response object.
*/
@Page('Products', 'products.ejs')
@GET('/products')
private products(req: Request, res: Response) {}
}

View file

@ -0,0 +1,18 @@
import { Request, Response } from 'express';
import { Controller, GET, Page, BaseController } from '@BridgemanAccessible/ba-web-framework';
/**
* The ServicesController class is responsible for handling the services page of the site.
*/
@Controller()
export class ServicesController extends BaseController {
/**
* Route for rendering the site's services page.
*
* @param req The request object.
* @param res The response object.
*/
@Page('Services', 'services.ejs')
@GET('/services')
private services(req: Request, res: Response) {}
}