34 lines
1.5 KiB
Plaintext
34 lines
1.5 KiB
Plaintext
-- SPDX-FileCopyrightText: 2022-24 Steffen Jost <jost@tcs.ifi.lmu.de>
|
|
--
|
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
-- Tables to save data received AVS
|
|
|
|
-- When creating an AvsUser the following cases are possible:
|
|
-- 1. User does not exist, hence a new UserId ought to be created.
|
|
-- 2. User does exists and can be matched by UserCompanyPersonalNumber
|
|
-- 3. User does exists but cannot be matched now :(
|
|
-- How can the matching be performed later?
|
|
-- Do we need to merge users?
|
|
-- > Handler.Utils.UsersassimilateUser
|
|
|
|
|
|
UserAvs
|
|
personId AvsPersonId -- unique identifier for user throughout avs; newtype for Int
|
|
user UserId
|
|
noPerson Int default=0 -- only needed for manual communication with personnel from Ausweisverwaltungsstelle, redundant since needed for filtering
|
|
lastSynch UTCTime default=now()
|
|
lastSynchError Text Maybe
|
|
lastPersonInfo AvsPersonInfo Maybe -- just to discern field changes
|
|
lastFirmInfo AvsFirmInfo Maybe -- just to discern field changes
|
|
lastCardNo AvsFullCardNo Maybe -- just to discern changes
|
|
UniqueUserAvsUser user
|
|
UniqueUserAvsId personId
|
|
deriving Generic Show
|
|
|
|
AvsSync
|
|
user UserId -- Note: we need to lookup UserAvs Entity anyway, so no benefit from storing AvsPersonId here
|
|
creationTime UTCTime
|
|
pause Day Maybe -- Don't synch if last synch after this day, otherwise synch
|
|
UniqueAvsSyncUser user
|
|
deriving Generic Show |