Files
XQKqueue/scripts/test-postgres.sh
brother7 17d296263c 修复账号禁用及队列场次状态规则
问题与需求:后台禁用员工后旧会话仍可继续访问;实时队列跨天误读昨日场次;项目暂停后需禁止取号但允许叫号。

修复思路:账号权限变更时撤销会话并同步前端登录态;实时查询统一按项目时区当天场次过滤;拆分取号与叫号的状态校验,并补充前后端及 PostgreSQL 回归测试。
2026-07-30 12:02:05 +08:00

28 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PG_BIN="${PG_BIN:-/opt/homebrew/opt/postgresql@17/bin}"
TEST_DB="queue_schema_test_$$"
cleanup() {
"$PG_BIN/dropdb" --if-exists --force "$TEST_DB" >/dev/null 2>&1 || true
}
trap cleanup EXIT INT TERM
"$PG_BIN/createdb" -O queue "$TEST_DB"
(
export TEST_DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
cd "$ROOT_DIR/server"
go test -p 1 ./internal/database ./internal/httpapi -run 'TestPostgresMigrationAndMaintenanceIntegration|TestHistoryEndpointsPostgresIntegration|TestDisablingStaffRevokesSessionsAndBlocksLoginPostgresIntegration|TestCurrentDayViewsIgnoreYesterdayRunningSessionPostgresIntegration|TestPausedProjectBlocksNewTicketsButAllowsCallingPostgresIntegration' -count=1
)
set -a
source "$ROOT_DIR/server/.env"
set +a
export APP_ENV=development
export DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
export MIGRATE_ON_START=false
export SUPER_ADMIN_PASSWORD='IntegrationOnlyPassword123!'
(cd "$ROOT_DIR/server" && go run ./cmd/bootstrap-admin >/dev/null)