Skip to content

Commit f28cd1f

Browse files
committed
Merge main into fix/render-deploy-lockfile; keep src/ layout and env-based config
2 parents a9597d3 + a86e7db commit f28cd1f

File tree

6 files changed

+107
-90
lines changed

6 files changed

+107
-90
lines changed

.gitignore

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,56 @@
1-
node_modules
2-
dist
1+
# Dependencies
2+
node_modules/
3+
.pnp
4+
.pnp.js
35

6+
# Testing
7+
coverage/
8+
.nyc_output
9+
10+
# Production
11+
dist/
12+
build/
13+
14+
# Environment variables
415
.env
5-
server/reset-db
6-
middleware/logger
7-
/logs
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
# Logs
22+
logs/
23+
*.log
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
pnpm-debug.log*
28+
lerna-debug.log*
29+
30+
# OS
31+
.DS_Store
32+
Thumbs.db
33+
34+
# IDE
35+
.vscode/
36+
.idea/
37+
*.swp
38+
*.swo
39+
*~
40+
41+
# TypeScript
42+
*.tsbuildinfo
43+
44+
# Database
45+
*.db
46+
*.sqlite
47+
*.sqlite3
48+
49+
# Temporary files
50+
tmp/
51+
temp/
52+
*.tmp
53+
54+
# Misc
55+
.cache/
56+
.parcel-cache/

config/bucket-storage/cloudinary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CloudinaryService {
3838

3939
try {
4040
const result = await cloudinary.uploader.upload(file as any, {
41-
folder: options.folder || 'museum-platform',
41+
folder: options.folder || 'library-platform',
4242
public_id: options.public_id,
4343
transformation: options.transformation,
4444
tags: options.tags,

direct-story-api.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

drizzle/meta/0000_snapshot.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"notNull": true,
1616
"default": "gen_random_uuid()"
1717
},
18-
"museum_id": {
19-
"name": "museum_id",
18+
"library_id": {
19+
"name": "library_id",
2020
"type": "uuid",
2121
"primaryKey": false,
2222
"notNull": true
@@ -57,12 +57,12 @@
5757
},
5858
"indexes": {},
5959
"foreignKeys": {
60-
"analytics_museum_id_museums_id_fk": {
61-
"name": "analytics_museum_id_museums_id_fk",
60+
"analytics_library_id_libraries_id_fk": {
61+
"name": "analytics_library_id_libraries_id_fk",
6262
"tableFrom": "analytics",
63-
"tableTo": "museums",
63+
"tableTo": "libraries",
6464
"columnsFrom": [
65-
"museum_id"
65+
"library_id"
6666
],
6767
"columnsTo": [
6868
"id"
@@ -101,8 +101,8 @@
101101
"notNull": true,
102102
"default": "gen_random_uuid()"
103103
},
104-
"museum_id": {
105-
"name": "museum_id",
104+
"library_id": {
105+
"name": "library_id",
106106
"type": "uuid",
107107
"primaryKey": false,
108108
"notNull": true
@@ -148,12 +148,12 @@
148148
},
149149
"indexes": {},
150150
"foreignKeys": {
151-
"contact_messages_museum_id_museums_id_fk": {
152-
"name": "contact_messages_museum_id_museums_id_fk",
151+
"contact_messages_library_id_libraries_id_fk": {
152+
"name": "contact_messages_library_id_libraries_id_fk",
153153
"tableFrom": "contact_messages",
154-
"tableTo": "museums",
154+
"tableTo": "libraries",
155155
"columnsFrom": [
156-
"museum_id"
156+
"library_id"
157157
],
158158
"columnsTo": [
159159
"id"
@@ -179,8 +179,8 @@
179179
"notNull": true,
180180
"default": "gen_random_uuid()"
181181
},
182-
"museum_id": {
183-
"name": "museum_id",
182+
"library_id": {
183+
"name": "library_id",
184184
"type": "uuid",
185185
"primaryKey": false,
186186
"notNull": true
@@ -245,12 +245,12 @@
245245
},
246246
"indexes": {},
247247
"foreignKeys": {
248-
"events_museum_id_museums_id_fk": {
249-
"name": "events_museum_id_museums_id_fk",
248+
"events_library_id_libraries_id_fk": {
249+
"name": "events_library_id_libraries_id_fk",
250250
"tableFrom": "events",
251-
"tableTo": "museums",
251+
"tableTo": "libraries",
252252
"columnsFrom": [
253-
"museum_id"
253+
"library_id"
254254
],
255255
"columnsTo": [
256256
"id"
@@ -276,8 +276,8 @@
276276
"notNull": true,
277277
"default": "gen_random_uuid()"
278278
},
279-
"museum_id": {
280-
"name": "museum_id",
279+
"library_id": {
280+
"name": "library_id",
281281
"type": "uuid",
282282
"primaryKey": false,
283283
"notNull": true
@@ -335,12 +335,12 @@
335335
},
336336
"indexes": {},
337337
"foreignKeys": {
338-
"media_items_museum_id_museums_id_fk": {
339-
"name": "media_items_museum_id_museums_id_fk",
338+
"media_items_library_id_libraries_id_fk": {
339+
"name": "media_items_library_id_libraries_id_fk",
340340
"tableFrom": "media_items",
341-
"tableTo": "museums",
341+
"tableTo": "libraries",
342342
"columnsFrom": [
343-
"museum_id"
343+
"library_id"
344344
],
345345
"columnsTo": [
346346
"id"
@@ -355,8 +355,8 @@
355355
"checkConstraints": {},
356356
"isRLSEnabled": false
357357
},
358-
"public.museums": {
359-
"name": "museums",
358+
"public.libraries": {
359+
"name": "libraries",
360360
"schema": "",
361361
"columns": {
362362
"id": {
@@ -435,8 +435,8 @@
435435
"notNull": false,
436436
"default": false
437437
},
438-
"museum_type": {
439-
"name": "museum_type",
438+
"library_type": {
439+
"name": "library_type",
440440
"type": "text",
441441
"primaryKey": false,
442442
"notNull": true
@@ -474,8 +474,8 @@
474474
"notNull": true,
475475
"default": "gen_random_uuid()"
476476
},
477-
"museum_id": {
478-
"name": "museum_id",
477+
"library_id": {
478+
"name": "library_id",
479479
"type": "uuid",
480480
"primaryKey": false,
481481
"notNull": true
@@ -555,12 +555,12 @@
555555
},
556556
"indexes": {},
557557
"foreignKeys": {
558-
"stories_museum_id_museums_id_fk": {
559-
"name": "stories_museum_id_museums_id_fk",
558+
"stories_library_id_libraries_id_fk": {
559+
"name": "stories_library_id_libraries_id_fk",
560560
"tableFrom": "stories",
561-
"tableTo": "museums",
561+
"tableTo": "libraries",
562562
"columnsFrom": [
563-
"museum_id"
563+
"library_id"
564564
],
565565
"columnsTo": [
566566
"id"
@@ -687,10 +687,10 @@
687687
"type": "text",
688688
"primaryKey": false,
689689
"notNull": true,
690-
"default": "'museum_admin'"
690+
"default": "'library_admin'"
691691
},
692-
"museum_id": {
693-
"name": "museum_id",
692+
"library_id": {
693+
"name": "library_id",
694694
"type": "uuid",
695695
"primaryKey": false,
696696
"notNull": true
@@ -712,12 +712,12 @@
712712
},
713713
"indexes": {},
714714
"foreignKeys": {
715-
"users_museum_id_museums_id_fk": {
716-
"name": "users_museum_id_museums_id_fk",
715+
"users_library_id_libraries_id_fk": {
716+
"name": "users_library_id_libraries_id_fk",
717717
"tableFrom": "users",
718-
"tableTo": "museums",
718+
"tableTo": "libraries",
719719
"columnsFrom": [
720-
"museum_id"
720+
"library_id"
721721
],
722722
"columnsTo": [
723723
"id"

index.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @module index
99
*/
1010

11-
import express, { type Request, Response, NextFunction } from "express";
11+
import express from "express";
1212
import session from "express-session";
1313
import MemoryStore from "memorystore";
1414
import connectPgSimple from "connect-pg-simple";
@@ -19,8 +19,7 @@ import { Pool } from "pg";
1919
import errorHandler from "./src/middlewares/error-handler";
2020
import helmet from "helmet";
2121
import cors from "cors";
22-
import { MemStorage } from "./config/database/storage";
23-
22+
import { env } from "./src/config/env";
2423
import corsOptions from "./config/cors/cors-options";
2524
import swaggerUi from "swagger-ui-express";
2625
import { openApiDocument } from "./config/swagger";
@@ -39,8 +38,6 @@ declare module "express-session" {
3938
}
4039
}
4140

42-
const PORT = process.env.PORT || 5500;
43-
4441
// Setup session stores
4542
const MemoryStoreSession = MemoryStore(session);
4643
const PgStore = connectPgSimple(session);
@@ -73,7 +70,7 @@ app.use(cors(corsOptions));
7370

7471
/** Session middleware: persistent in production (PgStore), in-memory otherwise */
7572
app.use(session({
76-
store: process.env.DATAAPI_URL
73+
store: env.DATAAPI_URL
7774
? new PgStore({
7875
pool,
7976
tableName: 'session',
@@ -82,11 +79,11 @@ app.use(session({
8279
: new MemoryStoreSession({
8380
checkPeriod: 86400000 // every 24h
8481
}),
85-
secret: process.env.SESSION_SECRET || 'library_connect_secret',
82+
secret: env.SESSION_SECRET,
8683
resave: false,
8784
saveUninitialized: false,
8885
cookie: {
89-
secure: process.env.NODE_ENV === 'production',
86+
secure: env.NODE_ENV === 'production',
9087
maxAge: 1000 * 60 * 60 * 24 // 24 hours
9188
}
9289
}));
@@ -126,9 +123,10 @@ app.use((req, res, next) => {
126123
const server = await registerRoutes("/api/v1", app);
127124
app.use(errorHandler);
128125

129-
server.listen(PORT, () => {
130-
console.log(`Server running at http://localhost:${PORT}`);
131-
}).on("error", () => {
132-
console.error("Error starting server");
126+
server.listen(env.PORT, () => {
127+
console.log(`Server running at http://localhost:${env.PORT} in ${env.NODE_ENV} mode`);
128+
}).on("error", (error) => {
129+
console.error("Error starting server:", error);
130+
process.exit(1);
133131
});
134132
})();

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"pg": "^8.16.0",
5151
"ts-jest": "^29.4.0",
5252
"uuid": "^11.1.0",
53+
"winston": "^3.19.0",
5354
"ws": "^8.18.0",
5455
"zod": "^3.24.2",
5556
"zod-validation-error": "^3.4.0",

0 commit comments

Comments
 (0)