Adding external connection to mongo
Adding endpoints Updating rest files
This commit is contained in:
parent
3a8f2949b2
commit
a510abd7f7
|
|
@ -1,5 +1,6 @@
|
|||
using api.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using models.Core;
|
||||
using models.Request;
|
||||
|
||||
namespace api.Controllers;
|
||||
|
|
@ -7,7 +8,7 @@ namespace api.Controllers;
|
|||
/// <summary>
|
||||
/// Endpoints for Event Management
|
||||
/// </summary>
|
||||
/// <param name="eventManager"></param>
|
||||
/// <param name="eventManager">Event Manager Service</param>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class EventController(IEventManager eventManager) : ControllerBase
|
||||
|
|
@ -28,6 +29,11 @@ public class EventController(IEventManager eventManager) : ControllerBase
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates an Event
|
||||
/// </summary>
|
||||
/// <param name="request">New Event Information</param>
|
||||
/// <returns></returns>
|
||||
[HttpPatch]
|
||||
public ActionResult Patch([FromBody] PatchEvent request)
|
||||
{
|
||||
|
|
@ -44,8 +50,14 @@ public class EventController(IEventManager eventManager) : ControllerBase
|
|||
}
|
||||
}
|
||||
|
||||
[HttpGet("{startDate}/{endDate}")]
|
||||
public ActionResult Get([FromRoute] DateTime startDate, DateTime endDate)
|
||||
/// <summary>
|
||||
/// Gets a list of all events between a start date and an end date
|
||||
/// </summary>
|
||||
/// <param name="startDate">Start date for the event search</param>
|
||||
/// <param name="endDate">End date for the event search</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult<List<Event>> Get(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class TicketController(
|
|||
/// </summary>
|
||||
/// <returns>Base64 String Qr Code</returns>
|
||||
[HttpPost]
|
||||
public ActionResult<MintResponse> AddTicket([FromBody] MintTickets mintRequest)
|
||||
public ActionResult<MintResponse> Post([FromBody] AddTicket mintRequest)
|
||||
{
|
||||
//TODO: Protect Endpoint
|
||||
|
||||
|
|
@ -40,6 +40,7 @@ public class TicketController(
|
|||
Id = ticketId,
|
||||
QrCode = qrCode,
|
||||
Type = mintRequest.Type,
|
||||
EventId = mintRequest.EventId
|
||||
};
|
||||
|
||||
//save the minted ticket
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Content-Type: application/json
|
|||
|
||||
###
|
||||
|
||||
PATCH {{api_HostAddress}}/Event
|
||||
PATCH {{api_HostAddress}}/event
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
|
|
@ -47,4 +47,10 @@ Content-Type: application/json
|
|||
"Name": "Parma Symphony Orchestra",
|
||||
"Description": "Parma Symphony Orchestra is a Northeast Ohio community orchestra with over 50 years of history bringing classical music to people of all ages, with opportunities for local students and professional guests to perform a wide ranging repertoire."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
GET {{api_HostAddress}}/event?startDate=2024-12-01&endDate=2024-12-31
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
|
@ -5,7 +5,8 @@ Accept: application/json
|
|||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"ticketType": "Single"
|
||||
"ticketType": "Single",
|
||||
"eventId": "1a06c032-b073-4715-9b95-9f3410e7abd9"
|
||||
}
|
||||
|
||||
###
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ public class TicketManager : ITicketManager
|
|||
{
|
||||
public void SaveMintedTicket(Ticket ticket)
|
||||
{
|
||||
//TODO: Add Ticket to Event
|
||||
new Save().Execute(ticket);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
},
|
||||
"Mongo": {
|
||||
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@192.168.1.14:27017/",
|
||||
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@www.taraformed.com:27017/",
|
||||
"Database": "pso"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
},
|
||||
"Mongo": {
|
||||
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@192.168.1.14:27017/",
|
||||
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@www.taraformed.com:27017/",
|
||||
"Database": "pso"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using models.Enumerations;
|
|||
|
||||
namespace models.Request;
|
||||
|
||||
public class MintTickets
|
||||
public class AddTicket
|
||||
{
|
||||
public TicketType Type { get; set; }
|
||||
public Guid EventId { get; set; }
|
||||
Loading…
Reference in New Issue
Block a user