Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitAuto: [FEATURE] Implement Category Specification API #341

Closed
21 changes: 21 additions & 0 deletions Src/Controllers/CategorySpecificationController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
// Placeholder for actual data retrieval logic
var specifications = new List<Models.CategorySpecificationModel>();
// TODO: Replace with actual data retrieval from database or service

namespace Src.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class CategorySpecificationController : ControllerBase
{
[HttpGet("{categoryId}/specifications")]
public IActionResult GetSpecificationsByCategory(int categoryId)
{
// TODO: Implement logic to retrieve specifications by category
return Ok(specifications);
}
}
}
10 changes: 10 additions & 0 deletions Src/Models/CategorySpecificationModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Src.Models
{
public class CategorySpecificationModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
// Add other relevant fields
}
}
24 changes: 24 additions & 0 deletions Tests/CategorySpecificationControllerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using Xunit;
using Src.Controllers;
using Microsoft.AspNetCore.Mvc;

namespace Tests
{
public class CategorySpecificationControllerTests
{
[Fact]
public void GetSpecificationsByCategory_ReturnsOkResult()
{
// Arrange
var controller = new CategorySpecificationController();
int testCategoryId = 1;

// Act
var result = controller.GetSpecificationsByCategory(testCategoryId);

// Assert
Assert.IsType<OkObjectResult>(result);
}
}
}
Loading