diff --git a/docker-compose.yml b/docker-compose.yml index ecc9717695..6271ba55bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -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: diff --git a/src/routes/sitemaps.ts b/src/routes/sitemaps.ts index 48a994ad6b..b17b47b8cc 100644 --- a/src/routes/sitemaps.ts +++ b/src/routes/sitemaps.ts @@ -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 { @@ -12,12 +12,14 @@ export default async function (fastify: FastifyInstance): Promise { '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();