Altinn / altinn-correspondence

Meldingstjenesten
3 stars 0 forks source link

Bug/fix datetimes #92

Closed Andreass2 closed 1 month ago

Andreass2 commented 1 month ago

Description

Related Issue(s)

Verification

Documentation

Ceredron commented 1 month ago

Should we set the the DateTime.NOW values in application or in the database? Theoretically there can be a timing issue if we mix the two as we will have two "sources-of-truth" for the current time. I'm guessing the difference would be in milliseconds top so problem may be insignificant.

Consistency can be good though. I think I would prefer to do it in the application (e.g, with DateTime.UtcNow) as that is where we also generate the GUID. Then the StatusChanged, Created fields etc would be non-nullable in the database.

Andreass2 commented 1 month ago

en the StatusChanged, Created fields etc would be non-nullable in the database.

I have changed it to be required values which are now set in the application layer.

Btw, the PrimaryKey GUID's are created by EF. Can also create a issue to change that if you think it is bad practise

Ceredron commented 1 month ago

en the StatusChanged, Created fields etc would be non-nullable in the database.

I have changed it to be required values which are now set in the application layer.

Btw, the PrimaryKey GUID's are created by EF. Can also create a issue to change that if you think it is bad practise

I did not notice that, but we do not need to change it I think. It's okay to do it either way as long as it is consistent in the same codebase.