(feature): user collection init
This commit is contained in:
parent
4b858008a9
commit
4abe7718eb
61
db/DML/user.json
Normal file
61
db/DML/user.json
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"_id": "fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
|
"sites": [
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"created": {
|
||||||
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
|
},
|
||||||
|
"nickaName": "hailstrike",
|
||||||
|
"passwords": {
|
||||||
|
"pwHash": "",
|
||||||
|
"pwSalt": "",
|
||||||
|
"created": {
|
||||||
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
|
},
|
||||||
|
"expiration": {
|
||||||
|
"$date": "2023-01-01T00:00:00.000Z"
|
||||||
|
},
|
||||||
|
"expired": [
|
||||||
|
{
|
||||||
|
"pwHash": "",
|
||||||
|
"pwSalt": "",
|
||||||
|
"created": {
|
||||||
|
"$date": "2022-01-01T00:00:00.000Z"
|
||||||
|
},
|
||||||
|
"expiration": {
|
||||||
|
"$date": "2023-01-01T00:00:00.000Z"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "John",
|
||||||
|
"lastName": "Doe",
|
||||||
|
"contacts": [
|
||||||
|
{
|
||||||
|
"type": 0,
|
||||||
|
"value": "john.doe@maks-it.com",
|
||||||
|
"confirmed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": 1,
|
||||||
|
"value": "+39000000",
|
||||||
|
"confirmed": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokens": [],
|
||||||
|
"billingAddress": {
|
||||||
|
"street": "",
|
||||||
|
"city": "",
|
||||||
|
"postCode": "",
|
||||||
|
"country": ""
|
||||||
|
},
|
||||||
|
"shippingAddress": {
|
||||||
|
"street": "",
|
||||||
|
"city": "",
|
||||||
|
"postCode": "",
|
||||||
|
"country": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@ -1,12 +1,14 @@
|
|||||||
using System;
|
using Core.Abstractions.DomainObjects;
|
||||||
using System.Collections.Generic;
|
using Core.Enumerations;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
public class Contact {
|
public class Contact : DomainObjectBase<Contact> {
|
||||||
|
public ContactTypes ContactType { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
public bool IsConfirmed { get; set; }
|
public bool Confirmed { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,27 @@
|
|||||||
using Core.Abstractions;
|
using Core.Abstractions.DomainObjects;
|
||||||
using Core.Abstractions.DomainObjects;
|
|
||||||
using Core.DomainObjects;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
|
|
||||||
|
|
||||||
public class User : DomainObjectDocumentBase<User> {
|
public class User : DomainObjectDocumentBase<User> {
|
||||||
|
|
||||||
|
public List<Guid> Sites { get; set; }
|
||||||
|
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
public string NickName { get; set; }
|
public string NickName { get; set; }
|
||||||
|
|
||||||
public string Hash { get; set; }
|
public Passwords Passwords { get; set; }
|
||||||
public string Salt { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
|
|
||||||
public Contact Email { get; set; }
|
public List<Contact> Contacts { get; set; }
|
||||||
public Contact Mobile { get; set; }
|
|
||||||
|
|
||||||
public Address BillingAddress { get; set; }
|
public Address BillingAddress { get; set; }
|
||||||
|
|
||||||
public Address ShippingAddress { get; set; }
|
public Address ShippingAddress { get; set; }
|
||||||
|
|
||||||
// manage whitelisted tokens as salted hash
|
public List<string> Tokens { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
25
webapi/Core/DomainObjects/Passwords.cs
Normal file
25
webapi/Core/DomainObjects/Passwords.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Core.Abstractions.DomainObjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Core.DomainObjects {
|
||||||
|
public class Passwords : DomainObjectBase<Passwords> {
|
||||||
|
|
||||||
|
public string PwHash { get; set; }
|
||||||
|
|
||||||
|
public string PwSalt { get; set; }
|
||||||
|
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
public DateTime? Expiration { get; set; }
|
||||||
|
|
||||||
|
public List<Passwords> Expired { get; set; }
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
webapi/Core/Enumerations/ContactTypes.cs
Normal file
11
webapi/Core/Enumerations/ContactTypes.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Core.Abstractions;
|
||||||
|
|
||||||
|
namespace Core.Enumerations {
|
||||||
|
public class ContactTypes : Enumeration {
|
||||||
|
|
||||||
|
public static ContactTypes Email = new(0, "email");
|
||||||
|
public static ContactTypes Mobile = new(1, "mobile");
|
||||||
|
|
||||||
|
private ContactTypes(int id, string displayName) : base (id, displayName) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -86,6 +86,9 @@ namespace DataProviders {
|
|||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Contact))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(Contact))) {
|
||||||
BsonClassMap.RegisterClassMap<Contact>(cm => {
|
BsonClassMap.RegisterClassMap<Contact>(cm => {
|
||||||
cm.AutoMap();
|
cm.AutoMap();
|
||||||
|
|
||||||
|
cm.GetMemberMap(c => c.ContactType)
|
||||||
|
.SetSerializer(new EnumerationSerializer<ContactTypes>());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +143,13 @@ namespace DataProviders {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!BsonClassMap.IsClassMapRegistered(typeof(Passwords))) {
|
||||||
|
BsonClassMap.RegisterClassMap<Passwords>(cm => {
|
||||||
|
cm.AutoMap();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Route))) {
|
if (!BsonClassMap.IsClassMapRegistered(typeof(Route))) {
|
||||||
BsonClassMap.RegisterClassMap<Route>(cm => {
|
BsonClassMap.RegisterClassMap<Route>(cm => {
|
||||||
cm.AutoMap();
|
cm.AutoMap();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user