using System.Collections.Generic; using Luticate2.Auth.DataAccess.Models; using Luticate2.Auth.Dbo.Groups; using Luticate2.Auth.Dbo.Tokens; using Luticate2.Auth.Dbo.Users; using Luticate2.Utils.Utils; using Newtonsoft.Json; namespace Luticate2.Auth.DataAccess { public static class ModelsToDbo { public static LuGroupsDbo ToDbo(this lu_groups model) { if (model == null) { return null; } return new LuGroupsDbo { Id = model.id.ToDbo(), Name = model.name }; } public static LuUsersFullDbo ToDbo(this lu_users model) { if (model == null) { return null; } return new LuUsersFullDbo { AuthenticationSourceId = model.authentication_source_id.ToDbo(), Data = JsonConvert.DeserializeObject>(model.data), Id = model.id.ToDbo(), Password = model.password, Salt = model.salt, Username = model.username }; } public static LuTokensDbo ToDbo(this lu_tokens model) { if (model == null) { return null; } return new LuTokensDbo { Data = JsonConvert.DeserializeObject>(model.data), Id = model.id, NotAfter = model.notAfter, NotBefore = model.notBefore, UserId = model.user_id.ToDbo() }; } } }