refactor(sql): moved new queries to there own folder to make it more easy to work and migrate
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
"dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts",
|
||||
"dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts",
|
||||
"build": "npm run build:server",
|
||||
"build:server": "rimraf dist && tsc --build && npm run copy:scripts && xcopy server\\services\\notifications\\utils\\views\\ dist\\server\\services\\notifications\\utils\\views\\ /E /I /Y ",
|
||||
"build:server": "rimraf dist && tsc --build && npm run copy:scripts && xcopy server\\services\\notifications\\utils\\views\\ dist\\server\\services\\notifications\\utils\\views\\ /E /I /Y && npm run build:copySql",
|
||||
"build:copySql": "xcopy server\\services\\sqlServer\\querys\\newQueries dist\\server\\services\\sqlServer\\querys\\newQueries\\ /E /I /Y ",
|
||||
"build:frontend": "cd frontend && npm run build",
|
||||
"build:iisNet": "rimraf dotnetwrapper\\bin && xcopy frontend\\dist dotnetwrapper\\wwwroot /E /I /Y && cd dotnetwrapper && dotnet publish lst-wrapper.csproj --configuration Release --output ../prodBuild",
|
||||
"copy:scripts": "tsx server/scripts/copyScripts.ts",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
checks the age of an inventory dose not exceed x time
|
||||
*/
|
||||
|
||||
use AlplaPROD_test1
|
||||
DECLARE @timeCheck INT = [timeTest]
|
||||
|
||||
select
|
||||
w.IdWarenLager as idWarehouse
|
||||
,w.KurzBezeichnung as warehouse
|
||||
,b.IdLagerAbteilung as locationId
|
||||
,x.KurzBezeichnung as 'location'
|
||||
--,case when b.upd_date < Dateadd(minute, -(@timeCheck * 1.5), getdate()) then 'OVERDUE' else 'In-Progress' end as invStatus
|
||||
,format(b.Upd_Date, 'M/d/yyyy HH:mm') as cycleCountStartAt
|
||||
,b.Upd_User as blockedBy
|
||||
|
||||
--,*
|
||||
|
||||
from [dbo].[V_LagerAbteilungenInventuren] (nolock) as b
|
||||
|
||||
-- get the loction name
|
||||
left join
|
||||
dbo.T_LagerAbteilungen (nolock) as x
|
||||
on x.IdLagerAbteilung = b.IdLagerAbteilung
|
||||
|
||||
-- get the whse
|
||||
left join
|
||||
dbo.T_WarenLager (nolock) as w
|
||||
on x.idWarenLager = w.idWarenLager
|
||||
|
||||
|
||||
where status = 1
|
||||
and b.Upd_Date < Dateadd(minute, -@timeCheck, getdate())
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
disables sql jobs.
|
||||
*/
|
||||
|
||||
DECLARE @JobName varchar(max) = '[jobName]'
|
||||
UPDATE msdb.dbo.sysjobs
|
||||
SET enabled = 0
|
||||
WHERE name = @JobName;
|
||||
@@ -1,14 +1,21 @@
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
export type SqlQuery = {
|
||||
query: string;
|
||||
success: boolean;
|
||||
message: string;
|
||||
};
|
||||
|
||||
export const sqlQuerySelector = (name: string) => {
|
||||
try {
|
||||
const queryFile = readFileSync(
|
||||
new URL(`../querys/${name}.sql`, import.meta.url),
|
||||
new URL(`../querys/newQueries/${name}.sql`, import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Query for: ${name}`,
|
||||
query: queryFile,
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user