42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
-- SPDX-FileCopyrightText: 2022 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
|
|
lastSynch UTCTime default=now()
|
|
lastSynchError Text Maybe
|
|
UniqueUserAvsUser user
|
|
UniqueUserAvsId personId
|
|
deriving Generic Show
|
|
|
|
-- Multiple UserAvsCards per UserAvs is possible and not too uncommon.
|
|
-- Purpose of saving cards is to detect external changes in qualifications and postal addresses
|
|
-- TODO: This table will be deleted if AVS CR3 SCF-165 is implemented
|
|
UserAvsCard
|
|
personId AvsPersonId
|
|
cardNo AvsFullCardNo
|
|
card AvsDataPersonCard
|
|
lastSynch UTCTime
|
|
-- UniqueAvsCard cardNo -- Note: cardNo is not unique; invalid cardNo may be reissued to different persons
|
|
deriving Generic
|
|
|
|
AvsSync
|
|
user UserId -- Note: we need to lookup UserAvs Entity anyway, so no benefit from storing AvsPersonId here
|
|
creationTime UTCTime
|
|
pause Day Maybe
|
|
UniqueAvsSyncUser user
|
|
deriving Generic |