Huge number of changes, upgrade to next 15, add loads of pages, auth, add ci, loads of clean up, a db for images etc

This commit is contained in:
2024-10-12 00:35:10 +01:00
parent 7f88af8ee3
commit 81d2cae9c7
42 changed files with 6511 additions and 1440 deletions

32
src/data-source.ts Normal file
View File

@@ -0,0 +1,32 @@
import { DataSource } from "typeorm";
import { Photo } from "./entity/photo";
const dataSource = new DataSource({
type: "better-sqlite3",
database: "db.sql",
entities: [Photo],
migrations: ["./migrations"],
})
export default class PhotoDataSource {
private static _dataSource: DataSource | null = null;
static get dataSource(): Promise<DataSource> {
if (PhotoDataSource._dataSource === null) {
return PhotoDataSource.initDataSource();
} else {
return Promise.resolve(PhotoDataSource._dataSource);
}
}
static async initDataSource(): Promise<DataSource> {
if (!PhotoDataSource._dataSource || !PhotoDataSource._dataSource.isInitialized) {
const ds = await dataSource.initialize();
console.log('Photo data source initialized')
PhotoDataSource._dataSource = ds;
}
return PhotoDataSource._dataSource;
}
}
PhotoDataSource.initDataSource();