-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into pr/jra/prod-release
- Loading branch information
Showing
7 changed files
with
328 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
coffeecard/CoffeeCard.Models/DataTransferObjects/v2/Product/AddProductRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using CoffeeCard.Models.Entities; | ||
|
||
namespace CoffeeCard.Models.DataTransferObjects.v2.Product | ||
{ | ||
/// <summary> | ||
/// Initiate a new product add request. | ||
/// </summary> | ||
/// <example> | ||
/// { | ||
/// "Name": "Latte", | ||
/// "Price": 25, | ||
/// "NumberOfTickets": 10, | ||
/// "Description": "xxx", | ||
/// "Visible": true | ||
/// } | ||
/// </example> | ||
public class AddProductRequest | ||
{ | ||
/// <summary> | ||
/// Gets or sets the price of the product. | ||
/// </summary> | ||
/// <value>Product Price</value> | ||
/// <example> 10 </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Price must be a non-negative integer.")] | ||
public int Price { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the number of tickets associated with the product. | ||
/// </summary> | ||
/// <value> Number of tickets associated with a product </value> | ||
/// <example> 5 </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Number of Tickets must be a non-negative integer.")] | ||
public int NumberOfTickets { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the product. | ||
/// </summary> | ||
/// <value> Product Name </value> | ||
/// <example> Latte </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Name cannot be an empty string.")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the description of the product. | ||
/// </summary> | ||
/// <value> Product Description </value> | ||
/// <example> A homemade latte with soy milk </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Description cannot be an empty string.")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the visibility of the product. Default is true. | ||
/// </summary> | ||
/// <value> Product Visibility </value> | ||
/// <example> true </example> | ||
[DefaultValue(true)] | ||
public bool Visible { get; set; } = true; | ||
|
||
[Required] | ||
public IEnumerable<UserGroup> AllowedUserGroups { get; set; } | ||
|
||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
coffeecard/CoffeeCard.Models/DataTransferObjects/v2/Product/ChangedProductResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace CoffeeCard.Models.DataTransferObjects.v2.Product | ||
{ | ||
/// <summary> | ||
/// Represents the product response. | ||
/// </summary> | ||
public class ChangedProductResponse | ||
{ | ||
/// <summary> | ||
/// Gets or sets the price of the product. | ||
/// </summary> | ||
/// <example> | ||
/// { | ||
/// "Price": 150, | ||
/// "NumberOfTickets": 10, | ||
/// "Name": "Espresso", | ||
/// "Description": "A coffee made by forcing steam through ground coffee beans.", | ||
/// "Visible": false | ||
/// } | ||
/// </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Price must be a non-negative integer.")] | ||
public int Price { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the number of tickets associated with the product. | ||
/// </summary> | ||
/// <value> Number of Tickets of a Product </value> | ||
/// <example> 5 </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Number of tickets must be a non-negative integer.")] | ||
public int NumberOfTickets { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the product. | ||
/// </summary> | ||
/// <value> Product Name </value> | ||
/// <example> Espresso </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Name cannot be an empty string.")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the description of the product. | ||
/// </summary> | ||
/// <value> Product Description </value> | ||
/// <example> A homemade espresso from fresh beans </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Description cannot be an empty string.")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the visibility of the product. | ||
/// </summary> | ||
/// <value> Product Visibility </value> | ||
/// <example> true </example> | ||
[Required] | ||
public bool Visible { get; set; } | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
coffeecard/CoffeeCard.Models/DataTransferObjects/v2/Product/UpdateProductRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace CoffeeCard.Models.DataTransferObjects.v2.Product | ||
{ | ||
/// /// <summary> | ||
/// Initiate an update product request. | ||
/// </summary> | ||
/// <example> | ||
/// { | ||
/// "Id": 1, | ||
/// "Price": 150, | ||
/// "NumberOfTickets": 10, | ||
/// "Name": "Espresso", | ||
/// "Description": "A coffee made by forcing steam through ground coffee beans.", | ||
/// "Visible": false | ||
/// } | ||
/// </example> | ||
public class UpdateProductRequest | ||
{ | ||
/// <summary> | ||
/// Gets or sets the ID of the product to update. | ||
/// </summary> | ||
/// <value> Product Id </value> | ||
/// <example> 1 </example> | ||
[Required] | ||
public int Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the updated price of the product. | ||
/// </summary> | ||
/// <value> Product Price </value> | ||
/// <example> 10 </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Price must be a non-negative integer.")] | ||
public int Price { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the updated number of tickets associated with the product. | ||
/// </summary> | ||
/// <value> Number of Tickets of a Product </value> | ||
/// <example> 5 </example> | ||
[Required] | ||
[Range(0, int.MaxValue, ErrorMessage = "Number of Tickets must be a non-negative integer.")] | ||
public int NumberOfTickets { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the updated name of the product. | ||
/// </summary> | ||
/// <value> Product Name </value> | ||
/// <example> Espresso </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Name cannot be an empty string.")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the updated description of the product. | ||
/// </summary> | ||
/// <value> Product Description </value> | ||
/// <example> A homemade espresso from fresh beans </example> | ||
[Required] | ||
[MinLength(1, ErrorMessage = "Description cannot be an empty string.")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the updated visibility of the product. Default is true. | ||
/// </summary> | ||
/// <value> Product Visibility </value> | ||
/// <example> true </example> | ||
[DefaultValue(true)] | ||
public bool Visible { get; set; } = true; | ||
} | ||
} |
Oops, something went wrong.