Skip to content

Commit

Permalink
fix: adjust sitemap and docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
idoshamun committed Jan 19, 2025
1 parent 0b00a6b commit 4e026cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ volumes:
services:

db:
image: postgres:15.4-alpine
image: postgres:17-alpine
environment:
- POSTGRES_MULTIPLE_DATABASES=api,api_test
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=12345
volumes:
- ./pg-init-scripts:/docker-entrypoint-initdb.d
Expand All @@ -22,7 +23,8 @@ services:

redis:
image: redis/redis-stack:7.2.0-v13
command: redis-server --appendonly yes
environment:
- REDIS_ARGS=--appendonly yes
volumes:
- redis:/data
ports:
Expand Down
8 changes: 5 additions & 3 deletions src/routes/sitemaps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FastifyInstance } from 'fastify';
import { Keyword, Post, PostType } from '../entity';
import { Keyword, Post, PostType, User } from '../entity';
import createOrGetConnection from '../db';

export default async function (fastify: FastifyInstance): Promise<void> {
Expand All @@ -12,12 +12,14 @@ export default async function (fastify: FastifyInstance): Promise<void> {
'url',
)
.from(Post, 'p')
.leftJoin(User, 'u', 'p."authorId" = u.id')
.where('type NOT IN (:...types)', { types: [PostType.Welcome] })
.andWhere('NOT private')
.andWhere('NOT banned')
.andWhere('NOT deleted')
.andWhere('"createdAt" > current_timestamp - interval \'90 day\'')
.orderBy('"createdAt"', 'DESC')
.andWhere('p."createdAt" > current_timestamp - interval \'90 day\'')
.andWhere('(u.id is null or u.reputation > 10)')
.orderBy('p."createdAt"', 'DESC')
.limit(50_000);

const input = await query.stream();
Expand Down

0 comments on commit 4e026cf

Please sign in to comment.