Files
Stefan 10ecdfa2e4 Add Fuchs_Database SSDT project (schema source of truth)
Adds the SQL Server Data Tools project for the fuchs_fds database — tables,
table types, functions and stored procedures that the backend calls (e.g.
fds__getInvoice, fds__merge_bankingtransactions, fds__tt__bankingtransactions,
fds__admin_getReportCatalog, fis_* auth). Build/model caches (bin, obj,
*.dbmdl, *.jfm, *.user) are git-ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:50:54 +02:00

35 lines
1006 B
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[fis_widgets_getCache]
@account varchar(50)
,@short_name varchar(50)
,@login_guid varchar(36)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @RET nvarchar(max);
DECLARE @IsCacheable bit, @Personalized bit;
SELECT @IsCacheable = [daycache], @personalized = [personalized]
FROM [dbo].[fis_widgets]
WHERE ([account] = @account OR [account] = '*') AND [short_name] = @short_name;
IF @IsCacheable = 1
BEGIN
DELETE FROM [dbo].[fis_widgets_cache] WHERE [date] <> CAST(GETUTCDATE() as date);
SELECT TOP(1)
@RET = [data]
FROM [dbo].[fis_widgets_cache]
WHERE [account] = @account
AND [short_name] = @short_name
AND [date] = CAST(GETUTCDATE() as date)
AND ((@Personalized = 1 AND [person_guid] = @login_guid) OR (@Personalized = 0));
END
SELECT @RET;
END