feat(admin): discount edit/delete + project-scoped scene/color editor
Identity (discounts):
- DiscountsController: PUT /v1/discounts/{id}, DELETE /v1/discounts/{id}
- DiscountService.UpdateAsync (partial update, code-clash guard) + DeleteAsync
- UpdateDiscountRequest record (all fields optional incl. is_active)
- Frontend discountsConfig: canEdit + canDelete + is_active field
Content (scenes/colors — UI for existing CRUD endpoints):
- New SceneColorEditor.tsx: 3-tab modal (scenes / shared-colors / color-presets),
project-scoped, full add/edit/delete per tab, colour pickers + palette item editor
- Wired into TemplatesAdmin: "صحنهها و رنگها" button per template variant row
- Routes through the generic admin proxy with ?project_id=
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,22 @@ public class DiscountsController(IDiscountService discountService) : ControllerB
|
||||
return StatusCode(201, result);
|
||||
}
|
||||
|
||||
[HttpPut("{id:guid}")]
|
||||
[ProducesResponseType(typeof(DiscountResponse), 200)]
|
||||
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateDiscountRequest request)
|
||||
{
|
||||
var result = await discountService.UpdateAsync(GetTenantId(), id, request);
|
||||
return result == null ? NotFound() : Ok(result);
|
||||
}
|
||||
|
||||
[HttpDelete("{id:guid}")]
|
||||
[ProducesResponseType(204)]
|
||||
public async Task<IActionResult> Delete(Guid id)
|
||||
{
|
||||
var ok = await discountService.DeleteAsync(GetTenantId(), id);
|
||||
return ok ? NoContent() : NotFound();
|
||||
}
|
||||
|
||||
private Guid GetTenantId() => Guid.Parse(User.FindFirst("tenant_id")?.Value
|
||||
?? throw new UnauthorizedAccessException());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user