forked from jmug/cactoide
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fefca207c5 | ||
|
|
e89c9b1843 | ||
|
|
4b14f649d6 |
@@ -4,7 +4,10 @@ POSTGRES_USER=cactoide
|
|||||||
POSTGRES_PASSWORD=cactoide_password
|
POSTGRES_PASSWORD=cactoide_password
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
|
|
||||||
|
# localhost
|
||||||
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database"
|
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database"
|
||||||
|
# docker
|
||||||
|
# DATABASE_URL="postgres://cactoide:cactoide_password@postgres:5432/cactoied_database"
|
||||||
|
|
||||||
# Application configuration
|
# Application configuration
|
||||||
APP_VERSION=latest
|
APP_VERSION=latest
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ services:
|
|||||||
image: postgres:15-alpine
|
image: postgres:15-alpine
|
||||||
container_name: cactoide-db
|
container_name: cactoide-db
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: ${POSTGRES_DB:-cactoied_database}
|
POSTGRES_DB: ${POSTGRES_DB:-cactoide_database}
|
||||||
POSTGRES_USER: ${POSTGRES_USER:-cactoide}
|
POSTGRES_USER: ${POSTGRES_USER:-cactoide}
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password}
|
||||||
ports:
|
expose:
|
||||||
- '${POSTGRES_PORT:-5432}:5432'
|
- '${POSTGRES_PORT:-5437}'
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
@@ -18,7 +18,7 @@ services:
|
|||||||
test:
|
test:
|
||||||
[
|
[
|
||||||
'CMD-SHELL',
|
'CMD-SHELL',
|
||||||
'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoied_database}'
|
'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoide_database}'
|
||||||
]
|
]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
@@ -31,9 +31,9 @@ services:
|
|||||||
image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest}
|
image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest}
|
||||||
container_name: cactoide-app
|
container_name: cactoide-app
|
||||||
ports:
|
ports:
|
||||||
- '${PORT:-3000}:3000'
|
- '${PORT:-5111}:3000'
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgres://${POSTGRES_USER:-cactoide}:${POSTGRES_PASSWORD:-cactoide_password}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-cactoied_database}
|
DATABASE_URL: ${DATABASE_URL}
|
||||||
PORT: 3000
|
PORT: 3000
|
||||||
HOSTNAME: ${HOSTNAME:-0.0.0.0}
|
HOSTNAME: ${HOSTNAME:-0.0.0.0}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ export function load({ cookies }) {
|
|||||||
const PATH = '/';
|
const PATH = '/';
|
||||||
|
|
||||||
if (!cactoideUserId) {
|
if (!cactoideUserId) {
|
||||||
console.log(`There is no cactoideUserId cookie, generating new one...`);
|
console.debug(`There is no cactoideUserId cookie, generating new one...`);
|
||||||
cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE });
|
cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE });
|
||||||
} else {
|
} else {
|
||||||
console.log(`cactoideUserId: ${cactoideUserId}`);
|
console.debug(`cactoideUserId: ${cactoideUserId}`);
|
||||||
console.log(`cactoideUserId cookie found, using existing one...`);
|
console.debug(`cactoideUserId cookie found, using existing one...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ export const load = async ({ cookies }) => {
|
|||||||
.where(eq(events.userId, userId))
|
.where(eq(events.userId, userId))
|
||||||
.orderBy(desc(events.createdAt));
|
.orderBy(desc(events.createdAt));
|
||||||
|
|
||||||
console.log(userEvents);
|
|
||||||
|
|
||||||
const transformedEvents = userEvents.map((event) => ({
|
const transformedEvents = userEvents.map((event) => ({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
name: event.name,
|
name: event.name,
|
||||||
|
|||||||
@@ -75,9 +75,6 @@ export const actions: Actions = {
|
|||||||
const name = formData.get('newAttendeeName') as string;
|
const name = formData.get('newAttendeeName') as string;
|
||||||
const userId = cookies.get('cactoideUserId');
|
const userId = cookies.get('cactoideUserId');
|
||||||
|
|
||||||
console.log(`name: ${name}`);
|
|
||||||
console.log(`userId: ${userId}`);
|
|
||||||
|
|
||||||
if (!name?.trim() || !userId) {
|
if (!name?.trim() || !userId) {
|
||||||
return fail(400, { error: 'Name and user ID are required' });
|
return fail(400, { error: 'Name and user ID are required' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user