Update Models

This commit is contained in:
Tech Garage 2024-01-25 20:36:44 +03:30
parent 0dad0d1a04
commit c36204dbb9
27 changed files with 509 additions and 5 deletions

View file

@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace MTWireGuard.Application.Models.Requests
{
public class ChangeStateRequest
{
[FromRoute(Name = "id"), Required]
public int Id { get; set; }
[FromBody, Required]
public bool Enabled { get; set; }
}
}

View file

@ -0,0 +1,22 @@
namespace MTWireGuard.Application.Models.Requests
{
public class CreateClientRequest
{
public string Name { get; set; }
public string? Endpoint { get; set; }
public ushort? EndpointPort { get; set; }
public string? AllowedAddress { get; set; }
public string? PresharedKey { get; set; }
public string PrivateKey { get; set; }
public string PublicKey { get; set; }
public string Interface { get; set; }
public int? KeepAlive { get; set; }
public bool Enabled { get; set; }
public string? Expire { get; set; }
public string? Password { get; set; }
public int? Traffic { get; set; }
public bool InheritIP { get; set; }
public bool InheritDNS { get; set; }
public string? DNSAddress { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTWireGuard.Application.Models.Requests
{
public class CreatePoolRequest
{
public string Name { get; set; }
public string? Next { get; set; }
public List<string> Ranges { get; set; }
}
}

View file

@ -0,0 +1,10 @@
namespace MTWireGuard.Application.Models.Requests
{
public class CreateScriptRequest
{
public string Name { get; set; }
public List<string> Policy { get; set; }
public string Source { get; set; }
public bool DontRequiredPermissions { get; set; }
}
}

View file

@ -0,0 +1,25 @@
namespace MTWireGuard.Application.Models.Requests
{
public class CreateServerRequest
{
public string Name { get; set; }
public ushort Port { get; set; } = 13231;
public ushort MTU { get; set; } = 1420;
public string PrivateKey { get; set; }
public bool Enabled { get; set; }
public string IPAddress { get; set; }
public bool UseIPPool { get; set; }
public int IPPoolId { get; set; }
public bool InheritDNS { get; set; }
public string DNSAddress { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace MTWireGuard.Application.Models.Requests
{
public class DeleteRequest
{
public int Id { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTWireGuard.Application.Models.Requests
{
public class LoginRequest
{
public string Username { get; set; }
public string Password { get; set; }
}
}

View file

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace MTWireGuard.Application.Models.Requests
{
public class SyncUserRequest
{
[FromRoute(Name = "id"), Required]
public int ID { get; set; }
[Required(ErrorMessage = "Username is required.")]
public string Name { get; set; }
[Required(ErrorMessage = "Password is required.")]
public string Password { get; set; }
[Required(ErrorMessage = "PrivateKey is required.")]
public string PrivateKey { get; set; }
[Required(ErrorMessage = "PublicKey is required.")]
public string PublicKey { get; set; }
}
}

View file

@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;
namespace MTWireGuard.Application.Models.Requests
{
public class UpdateClientRequest
{
[FromRoute(Name = "id"), Required]
public int ID { get; set; }
public string? Name { get; set; }
public string? Endpoint { get; set; }
public ushort? EndpointPort { get; set; }
public string? AllowedAddress { get; set; }
public string? PresharedKey { get; set; }
public string? PrivateKey { get; set; }
public string? PublicKey { get; set; }
public string Interface { get; set; }
public int? KeepAlive { get; set; }
public string? Expire { get; set; }
public string? Password { get; set; }
public int? Traffic { get; set; }
public bool InheritIP { get; set; }
public bool InheritDNS { get; set; }
public string? DNSAddress { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTWireGuard.Application.Models.Requests
{
public class UpdateDNSRequest
{
public List<string> Servers { get; set; }
}
}

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTWireGuard.Application.Models.Requests
{
public class UpdateIPPoolRequest
{
public int Id { get; set; }
public string Name { get; set; }
public string? Next { get; set; }
public List<string> Ranges { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MTWireGuard.Application.Models.Requests
{
public class UpdateIdentityRequest
{
public string Name { get; set; }
}
}

View file

@ -0,0 +1,25 @@
namespace MTWireGuard.Application.Models.Requests
{
public class UpdateServerRequest
{
public int Id { get; set; }
public string Name { get; set; }
public ushort? Port { get; set; }
public ushort? MTU { get; set; }
public string? PrivateKey { get; set; }
public string? IPAddress { get; set; }
public bool UseIPPool { get; set; }
public int? IPPoolId { get; set; }
public bool InheritDNS { get; set; }
public string? DNSAddress { get; set; }
}
}