blob: 0996cc0f34a6e502195d936818538ce25bd0e490 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
namespace Quality.Storage.Api.Database.Models;
public class Base
{
protected Base() {
Id = Guid.NewGuid();
CreatedAt = AppDateTime.UtcNow;
}
protected Base(Guid createdBy) {
Id = Guid.NewGuid();
CreatedAt = AppDateTime.UtcNow;
CreatedBy = createdBy;
}
public Guid Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? LastModifiedAt { get; set; }
public DateTime? LastDeletedAt { get; set; }
public Guid? LastModifiedBy { get; set; }
public Guid? LastDeletedBy { get; set; }
public Guid? CreatedBy { get; set; }
public void SetDeleted(Guid performingUserId = default) {
LastDeletedAt = AppDateTime.UtcNow;
LastDeletedBy = performingUserId;
}
public void SetModified(Guid performingUserId = default) {
LastModifiedAt = AppDateTime.UtcNow;
LastModifiedBy = performingUserId;
}
public abstract class WithOwner : Base
{
protected WithOwner() { }
protected WithOwner(Guid createdBy) : base(createdBy) { }
public Guid? OwningUserId { get; set; }
public void SetOwner(Guid ownerId = default) {
OwningUserId = ownerId;
}
}
}
|