39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using MongoDB.Bson.Serialization.Attributes;
|
|
using MongoDB.Bson;
|
|
using System.Security.Claims;
|
|
using ChatApi.Controllers;
|
|
|
|
namespace ChatApi.Models
|
|
{
|
|
public class UserData
|
|
{
|
|
public UserData()
|
|
{
|
|
}
|
|
|
|
[BsonId]
|
|
[BsonElement("_id")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
public string Id { get; set; }
|
|
public string LocalId { get; set; }
|
|
public string Name { get; set; }
|
|
public string Secret { get; set; }
|
|
public string CompanyTenant { get; set; }
|
|
public string? Email { get; set; }
|
|
public string? LastToken { get; set; }
|
|
public DateTime? DateTimeToken { get; set; }
|
|
|
|
public static UserData Create(UserRequest userRequest, string secret)
|
|
{
|
|
return new UserData
|
|
{
|
|
Id = Guid.NewGuid().ToString("N"),
|
|
Name = userRequest.Name,
|
|
CompanyTenant = userRequest.CompanyTenant,
|
|
LocalId = userRequest.LocalId,
|
|
Secret = secret
|
|
};
|
|
}
|
|
}
|
|
}
|