diff --git a/src/Robware.Data/ApiKeys/DatabaseApiKey.cs b/src/Robware.Data/ApiKeys/DatabaseApiKey.cs new file mode 100644 index 0000000..7aa97e5 --- /dev/null +++ b/src/Robware.Data/ApiKeys/DatabaseApiKey.cs @@ -0,0 +1,13 @@ +using Robware.Auth.API; +using Robware.Data.ApiKeys.State; + +namespace Robware.Data.ApiKeys { + public class DatabaseApiKey:ApiKey { + public DatabaseApiKey(ApiKeyState state) { + Name = state.Name; + Key = state.Key; + IssueTimestamp = state.IssueTimestamp; + Enabled = state.Enabled; + } + } +} \ No newline at end of file diff --git a/src/Robware.Data/ApiKeys/State/ApiKeyState.cs b/src/Robware.Data/ApiKeys/State/ApiKeyState.cs new file mode 100644 index 0000000..8854480 --- /dev/null +++ b/src/Robware.Data/ApiKeys/State/ApiKeyState.cs @@ -0,0 +1,21 @@ +using MongoDB.Bson.Serialization.Attributes; +using Robware.Auth.API; +using System; + +namespace Robware.Data.ApiKeys.State { + public class ApiKeyState { + public ApiKeyState(ApiKey apiKey) { + Name = apiKey.Name; + IssueTimestamp = apiKey.IssueTimestamp; + Key = apiKey.Key; + Enabled = apiKey.Enabled; + } + + [BsonId] + public int Id { get; set; } + public string Name { get; set; } + public DateTime IssueTimestamp { get; set; } + public string Key { get; set; } + public bool Enabled { get; set; } + } +} \ No newline at end of file