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

33 lines
1.2 KiB
Transact-SQL

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fis_admin_authenticate]
(
@email varchar(255),
@password nvarchar(20)
)
RETURNS @RET TABLE ( [useraccount_id] varchar(5), [auth] smallint, [name] nvarchar(100) null, [firstname] nvarchar(100) null, [email] varchar(255) NULL, [mobile] varchar(50) null, [functions] varchar(1000), [language] varchar(2), [fullname] nvarchar(255) null, [fullname_rev] nvarchar(255) null)
AS
BEGIN
DECLARE @auth smallint = -1;
DECLARE @useraccount_id varchar(10), @name nvarchar(255), @mobile varchar(50), @functions varchar(1000) = '';
SELECT TOP(1) @useraccount_id = [useraccount_id]
FROM [dbo].[fis_useraccounts] as ua
WHERE ua.[DateDeleted] is null AND ua.[DateDisabled] is null
AND CAST(DECRYPTBYKEY(ua.[email_enc]) as varchar(255)) = @email
AND @email <> ''
AND CAST(DECRYPTBYKEY(ua.[password_enc]) as nvarchar(20)) = @password
AND @password <> ''
AND ua.[password_enc] is not null;
INSERT INTO @RET SELECT * FROM [dbo].[fis_admin_getUserAccount](@useraccount_id);
RETURN;
END