1
0
mirror of https://github.com/bitwarden/server synced 2025-12-15 15:53:59 +00:00

Move request/response models (#1754)

This commit is contained in:
Oscar Hinton
2021-12-14 15:05:07 +00:00
committed by GitHub
parent 3ae573bd8d
commit 63f6dd9a24
206 changed files with 641 additions and 516 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using Bit.Core.Enums;
using Bit.Core.Models.Api;
using Bit.Core.Models.Table;
using Newtonsoft.Json;
namespace Bit.Api.Models.Response
{
public class PolicyResponseModel : ResponseModel
{
public PolicyResponseModel(Policy policy, string obj = "policy")
: base(obj)
{
if (policy == null)
{
throw new ArgumentNullException(nameof(policy));
}
Id = policy.Id.ToString();
OrganizationId = policy.OrganizationId.ToString();
Type = policy.Type;
Enabled = policy.Enabled;
if (!string.IsNullOrWhiteSpace(policy.Data))
{
Data = JsonConvert.DeserializeObject<Dictionary<string, object>>(policy.Data);
}
}
public string Id { get; set; }
public string OrganizationId { get; set; }
public PolicyType Type { get; set; }
public Dictionary<string, object> Data { get; set; }
public bool Enabled { get; set; }
}
}