Added authentication
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class Address
|
||||
{
|
||||
public string Street { get; set; } = "";
|
||||
public string City { get; set; } = "";
|
||||
public string PostalCode { get; set; } = "";
|
||||
public string Country { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class CreateOrderRequest
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public List<OrderLine> Lines { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class CreateUserRequest
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
public string Email { get; set; } = "";
|
||||
|
||||
public UserRole Role { get; set; } = UserRole.Member;
|
||||
|
||||
public Address? Address { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
public enum UserRole
|
||||
{
|
||||
Admin,
|
||||
Member,
|
||||
Guest
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
public string Email { get; set; } = "";
|
||||
|
||||
public UserRole Role { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public Address? Address { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; } = new();
|
||||
}
|
||||
|
||||
public class Address
|
||||
{
|
||||
public string Street { get; set; } = "";
|
||||
public string City { get; set; } = "";
|
||||
public string PostalCode { get; set; } = "";
|
||||
public string Country { get; set; } = "";
|
||||
}
|
||||
|
||||
public class CreateUserRequest
|
||||
{
|
||||
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
public string Email { get; set; } = "";
|
||||
|
||||
public UserRole Role { get; set; } = UserRole.Member;
|
||||
|
||||
public Address? Address { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateUserRequest
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public UserRole? Role { get; set; }
|
||||
}
|
||||
|
||||
public class Order
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public List<OrderLine> Lines { get; set; } = new();
|
||||
public decimal Total { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public DateTime PlacedAt { get; set; }
|
||||
}
|
||||
|
||||
public class OrderLine
|
||||
{
|
||||
public string Sku { get; set; } = "";
|
||||
public int Quantity { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
}
|
||||
|
||||
public enum OrderStatus
|
||||
{
|
||||
Pending,
|
||||
Paid,
|
||||
Shipped,
|
||||
Delivered,
|
||||
Cancelled
|
||||
}
|
||||
|
||||
public class CreateOrderRequest
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public List<OrderLine> Lines { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class Order
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public List<OrderLine> Lines { get; set; } = new();
|
||||
public decimal Total { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public DateTime PlacedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class OrderLine
|
||||
{
|
||||
public string Sku { get; set; } = "";
|
||||
public int Quantity { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public enum OrderStatus
|
||||
{
|
||||
Pending,
|
||||
Paid,
|
||||
Shipped,
|
||||
Delivered,
|
||||
Cancelled
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class UpdateUserRequest
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public UserRole? Role { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
public string Email { get; set; } = "";
|
||||
|
||||
public UserRole Role { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public Address? Address { get; set; }
|
||||
|
||||
public List<string> Tags { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace SampleApi.Models
|
||||
{
|
||||
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
||||
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
|
||||
|
||||
public enum UserRole
|
||||
{
|
||||
Admin,
|
||||
Member,
|
||||
Guest
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user