Adding external connection to mongo

Adding endpoints
Updating rest files
This commit is contained in:
Tara Wilson 2024-12-02 20:52:16 -05:00
parent 3a8f2949b2
commit a510abd7f7
8 changed files with 31 additions and 10 deletions

View File

@ -1,5 +1,6 @@
using api.Interfaces; using api.Interfaces;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using models.Core;
using models.Request; using models.Request;
namespace api.Controllers; namespace api.Controllers;
@ -7,7 +8,7 @@ namespace api.Controllers;
/// <summary> /// <summary>
/// Endpoints for Event Management /// Endpoints for Event Management
/// </summary> /// </summary>
/// <param name="eventManager"></param> /// <param name="eventManager">Event Manager Service</param>
[ApiController] [ApiController]
[Route("[controller]")] [Route("[controller]")]
public class EventController(IEventManager eventManager) : ControllerBase 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] [HttpPatch]
public ActionResult Patch([FromBody] PatchEvent request) public ActionResult Patch([FromBody] PatchEvent request)
{ {
@ -44,8 +50,14 @@ public class EventController(IEventManager eventManager) : ControllerBase
} }
} }
[HttpGet("{startDate}/{endDate}")] /// <summary>
public ActionResult Get([FromRoute] DateTime startDate, DateTime endDate) /// 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 try
{ {

View File

@ -22,7 +22,7 @@ public class TicketController(
/// </summary> /// </summary>
/// <returns>Base64 String Qr Code</returns> /// <returns>Base64 String Qr Code</returns>
[HttpPost] [HttpPost]
public ActionResult<MintResponse> AddTicket([FromBody] MintTickets mintRequest) public ActionResult<MintResponse> Post([FromBody] AddTicket mintRequest)
{ {
//TODO: Protect Endpoint //TODO: Protect Endpoint
@ -40,6 +40,7 @@ public class TicketController(
Id = ticketId, Id = ticketId,
QrCode = qrCode, QrCode = qrCode,
Type = mintRequest.Type, Type = mintRequest.Type,
EventId = mintRequest.EventId
}; };
//save the minted ticket //save the minted ticket

View File

@ -25,7 +25,7 @@ Content-Type: application/json
### ###
PATCH {{api_HostAddress}}/Event PATCH {{api_HostAddress}}/event
Accept: application/json Accept: application/json
Content-Type: application/json Content-Type: application/json
@ -48,3 +48,9 @@ Content-Type: application/json
"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." "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

View File

@ -5,7 +5,8 @@ Accept: application/json
Content-Type: application/json Content-Type: application/json
{ {
"ticketType": "Single" "ticketType": "Single",
"eventId": "1a06c032-b073-4715-9b95-9f3410e7abd9"
} }
### ###

View File

@ -8,6 +8,7 @@ public class TicketManager : ITicketManager
{ {
public void SaveMintedTicket(Ticket ticket) public void SaveMintedTicket(Ticket ticket)
{ {
//TODO: Add Ticket to Event
new Save().Execute(ticket); new Save().Execute(ticket);
} }
} }

View File

@ -6,7 +6,7 @@
} }
}, },
"Mongo": { "Mongo": {
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@192.168.1.14:27017/", "ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@www.taraformed.com:27017/",
"Database": "pso" "Database": "pso"
} }
} }

View File

@ -6,7 +6,7 @@
} }
}, },
"Mongo": { "Mongo": {
"ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@192.168.1.14:27017/", "ConnectionString": "mongodb://terralilly85:pr1ncessN0ra@www.taraformed.com:27017/",
"Database": "pso" "Database": "pso"
}, },
"AllowedHosts": "*" "AllowedHosts": "*"

View File

@ -2,7 +2,7 @@ using models.Enumerations;
namespace models.Request; namespace models.Request;
public class MintTickets public class AddTicket
{ {
public TicketType Type { get; set; } public TicketType Type { get; set; }
public Guid EventId { get; set; } public Guid EventId { get; set; }