EMS: move DB connection to env

This commit is contained in:
cracklesparkle
2024-12-18 11:28:38 +09:00
parent 87866e4e51
commit dec796b75e
5 changed files with 21 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import express, { Request, Response } from 'express';
import { tediousQuery } from '../../utils/tedious';
import { GeneralDB } from '../../constants/db';
import { GeneralDB, GisDB } from '../../constants/db';
const router = express.Router()
router.get('/regions/all', async (req: Request, res: Response) => {
@ -120,7 +120,7 @@ router.get('/objects/list', async (req: Request, res: Response) => {
type_id,
CAST(LEFT(caption_params, CHARINDEX(',', caption_params + ',') - 1) AS VARCHAR(255)), -- Explicitly casting to VARCHAR
STUFF(caption_params, 1, CHARINDEX(',', caption_params + ','), '')
FROM New_Gis..caption_params
FROM ${GisDB}..caption_params
WHERE city_id = -1 AND user_id = -1
UNION ALL
@ -143,7 +143,7 @@ router.get('/objects/list', async (req: Request, res: Response) => {
FROM ${GeneralDB}..vObjects o
JOIN cte_split c ON o.type = c.type_id
JOIN ${GeneralDB}..tParameters p ON p.id = split_value
JOIN ${GeneralDB}..tValues v
LEFT JOIN ${GeneralDB}..tValues v
ON
v.id_param = split_value
AND v.id_object = o.object_id