Refactor HTML and configuration files for improved structure and consistency

- Updated videos.html to enhance readability and maintainability.
- Refactored webpack.config.js for better organization and clarity.
- Cleaned up TypeScript configuration files (tsconfig.app.json, tsconfig.json, tsconfig.spec.json) for consistency in formatting.
- Adjusted docker-compose.yaml for improved formatting and readability.
This commit is contained in:
Marek Lesko
2025-08-05 06:35:56 +00:00
parent 83ca026a55
commit 02116aa3df
312 changed files with 45638 additions and 45628 deletions

View File

@@ -1,70 +1,70 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Api.Models;
using Microsoft.AspNetCore.Authorization;
namespace Api.Controllers
{
[ApiController]
[Authorize]
[Route("api/product")]
public class ProductController : ControllerBase
{
private readonly AppDbContext _context;
public ProductController(AppDbContext context)
{
_context = context;
}
// GET: api/Product
[HttpGet]
public async Task<ActionResult<IEnumerable<Product>>> GetProducts([FromQuery] int? id = null)
{
if (id.HasValue)
{
return await _context.Products
.Where(p => p.Id == id.Value)
.ToListAsync();
}
else
return await _context.Products.ToListAsync();
}
// POST: api/Product
[HttpPost]
public async Task<ActionResult<Product>> PostProduct([FromBody] Product product)
{
_context.Products.Add(product);
await _context.SaveChangesAsync();
return CreatedAtAction(nameof(GetProducts), new { id = product.Id }, product);
}
// PUT: api/Product/{id}
[HttpPut("{id}")]
public async Task<IActionResult> PutProduct(int id, [FromBody] Product product)
{
if (id != product.Id)
{
return BadRequest();
}
_context.Entry(product).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!await _context.Products.AnyAsync(e => e.Id == id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
}
}
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Api.Models;
using Microsoft.AspNetCore.Authorization;
namespace Api.Controllers
{
[ApiController]
[Authorize]
[Route("api/product")]
public class ProductController : ControllerBase
{
private readonly AppDbContext _context;
public ProductController(AppDbContext context)
{
_context = context;
}
// GET: api/Product
[HttpGet]
public async Task<ActionResult<IEnumerable<Product>>> GetProducts([FromQuery] int? id = null)
{
if (id.HasValue)
{
return await _context.Products
.Where(p => p.Id == id.Value)
.ToListAsync();
}
else
return await _context.Products.ToListAsync();
}
// POST: api/Product
[HttpPost]
public async Task<ActionResult<Product>> PostProduct([FromBody] Product product)
{
_context.Products.Add(product);
await _context.SaveChangesAsync();
return CreatedAtAction(nameof(GetProducts), new { id = product.Id }, product);
}
// PUT: api/Product/{id}
[HttpPut("{id}")]
public async Task<IActionResult> PutProduct(int id, [FromBody] Product product)
{
if (id != product.Id)
{
return BadRequest();
}
_context.Entry(product).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!await _context.Products.AnyAsync(e => e.Id == id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
}
}