Skip to content

Commit

Permalink
Merge pull request #20 from EspadaKomanda/additions-since-semifinal
Browse files Browse the repository at this point in the history
Added changes since semifinal
  • Loading branch information
ReallyWeirdCat authored Nov 19, 2024
2 parents 9aa8acd + 0c291ce commit 27a256f
Show file tree
Hide file tree
Showing 541 changed files with 25,276 additions and 19,707 deletions.
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"sqltools.connections": [
{
"previewLimit": 50,
"server": "212.109.196.0",
"port": 5432,
"driver": "PostgreSQL",
"name": "5432",
"database": "tourdb",
"username": "postgres"
}
]
}
1 change: 1 addition & 0 deletions 5432.session.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6

This file was deleted.

9 changes: 6 additions & 3 deletions ApiGatewayService/Controllers/AuthService/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class AuthController(ILogger<AuthController> logger, IAuthService authSer
private readonly ILogger<AuthController> _logger = logger;
private readonly IAuthService _authService = authService;

[HttpPost("validateAccessToken")]
[HttpPost]
[Route("validateAccessToken")]
public async Task<IActionResult> ValidateAccessToken([FromBody] ValidateAccessTokenRequest request)
{
try
Expand All @@ -31,7 +32,8 @@ public async Task<IActionResult> ValidateAccessToken([FromBody] ValidateAccessTo
}
}

[HttpPost("validateRefreshToken")]
[HttpPost]
[Route("validateRefreshToken")]
public async Task<IActionResult> ValidateRefreshToken([FromBody] ValidateRefreshTokenRequest request)
{
try
Expand All @@ -49,7 +51,8 @@ public async Task<IActionResult> ValidateRefreshToken([FromBody] ValidateRefresh
}
}

[HttpPost("refresh")]
[HttpPost]
[Route("refresh")]
public async Task<IActionResult> Refresh([FromBody] RefreshRequest request)
{
try
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
using ApiGatewayService.Services.EntertaimentService.Benefits;
using EntertaimentService.Models.Benefits;
using Microsoft.AspNetCore.Mvc;
using TourService.KafkaException;

namespace ApiGatewayService.Controllers.EntertainmentService;

[ApiController]
[Route("api/[controller]")]
public class BenefitController : ControllerBase
[Route("api/[controller]/ent")]
public class BenefitController(IEntertaimentBenefitService entertainmentBenefitsService, ILogger<BenefitController> logger) : ControllerBase
{
public Task<IActionResult> GetBenefit()
private readonly IEntertaimentBenefitService _entertainmentBenefitsService = entertainmentBenefitsService;
private readonly ILogger<BenefitController> _logger = logger;

[HttpGet]
[Route("benefits/{benefitId}")]
public IActionResult GetBenefit([FromRoute] long benefitId)
{
throw new NotImplementedException();
GetBenefitRequest request = new(){BenefitId = benefitId};

try
{
var result = _entertainmentBenefitsService.GetBenefit(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
public IQueryable<IActionResult> GetBenefits()

[HttpGet]
[Route("benefits/page/{pageId}")]
public IActionResult GetBenefits([FromRoute] int pageId)
{
throw new NotImplementedException();
GetBenefitsRequest request = new(){Page = pageId};

try
{
var result = _entertainmentBenefitsService.GetBenefits(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,55 @@
using ApiGatewayService.Services.EntertaimentService.Categories;
using EntertaimentService.Models.Category.Requests;
using Microsoft.AspNetCore.Mvc;
using TourService.KafkaException;

namespace ApiGatewayService.Controllers.EntertainmentService;

[ApiController]
[Route("api/[controller]")]
public class CategoryController : ControllerBase
[Route("api/[controller]/ent")]
public class CategoryController(ILogger<CategoryController> logger, IEntertaimentCategoryService entertainmentCategoryService) : ControllerBase
{
public Task<IActionResult> GetCategory()
private readonly ILogger<CategoryController> _logger = logger;
private readonly IEntertaimentCategoryService _tourCategoryService = entertainmentCategoryService;

[HttpGet]
[Route("categories/{categoryId}")]
public async Task<IActionResult> GetCategory([FromRoute] long categoryId)
{
throw new NotImplementedException();
GetCategoryRequest request = new(){CategoryId = categoryId};
try
{
var result = await _tourCategoryService.GetCategory(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}

public IQueryable<IActionResult> GetCategories()
[HttpGet]
[Route("categories/page/{pageId}")]
public async Task<IActionResult> GetCategories([FromRoute] int pageId)
{
throw new NotImplementedException();
GetCategoriesRequest request = new(){Page = pageId};

try
{
var result = await _tourCategoryService.GetCategories(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,183 @@
using ApiGatewayService.Services.EntertaimentService.Entertaiments;
using EntertaimentService.Models.Entertaiment.Requests;
using EntertaimentService.Models.Tour.Requests;
using Microsoft.AspNetCore.Mvc;
using TourService.KafkaException;

namespace ApiGatewayService.Controllers.EntertainmentService;

[ApiController]
[Route("api/[controller]")]
public class TourController : ControllerBase
[Route("api/[controller]/ent")]
public class EntertaimentController(ILogger<EntertaimentController> logger, IEntertaimentService entertainmentService) : ControllerBase
{
public Task<IActionResult> GetEntertainment()
private readonly ILogger<EntertaimentController> _logger = logger;
private readonly IEntertaimentService _entertainmentService = entertainmentService;
[HttpPost]
[Route("entertainments")]
public async Task<IActionResult> AddEntertainment(AddEntertaimentRequest request)
{
throw new NotImplementedException();
try
{
var result = await _entertainmentService.AddEntertaiment(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
public Task<IActionResult> GetEntertainments()
[HttpGet]
[Route("entertainments/{entertainmentId}")]
public async Task<IActionResult> GetEntertainment([FromRoute] long entertainmentId)
{
throw new NotImplementedException();
GetEntertaimentRequest request = new() { Id = entertainmentId };
try
{
var result = await _entertainmentService.GetEntertaiment(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
[HttpPatch]
[Route("entertainments")]
public async Task<IActionResult> UpdateEntertainment(UpdateEntertaimentRequest request)
{
try
{
var result = await _entertainmentService.UpdateEntertaiment(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
[HttpDelete]
[Route("entertainments")]
public async Task<IActionResult> RemoveEntertainment(RemoveEntertaimentRequest request)
{
try
{
var result = await _entertainmentService.RemoveEntertaiment(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
[HttpGet]
[Route("entertainments/page/{pageId}")]
public async Task<IActionResult> GetEntertainments([FromRoute] int pageId)
{
GetEntertaimentsRequest request = new() { Page = pageId };
try
{
var result = await _entertainmentService.GetEntertaiments(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}

[HttpPost]
[Route("linkCategories")]
public async Task<IActionResult> LinkCategories(LinkCategoriesEntertaimentRequests request)
{
try
{
var result = await _entertainmentService.LinkCategories(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}

[HttpDelete]
[Route("unlinkCategory")]
public async Task<IActionResult> UnlinkCategory(UnlinkCategoryEntertaimentRequest request)
{
try
{
var result = await _entertainmentService.UnlinkCategory(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}

[HttpPost]
[Route("linkPaymentMethods")]
public async Task<IActionResult> LinkPaymentMethods(LinkPaymentMethodsEntertaimentRequest request)
{
try
{
var result = await _entertainmentService.LinkPaymentMethods(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}

[HttpDelete]
[Route("unlinkPaymentMethods")]
public async Task<IActionResult> UnlinkPaymentMethod(UnlinkPaymentMethodEntertaimentRequest request)
{
try
{
var result = await _entertainmentService.UnlinkPaymentMethod(request);
return Ok(result);
}
catch(Exception ex)
{
if(ex is MyKafkaException)
{
return StatusCode(500, ex.Message);
}
return BadRequest(ex.Message);
}
}
}
Loading

0 comments on commit 27a256f

Please sign in to comment.