-
Notifications
You must be signed in to change notification settings - Fork 2
.Net6 Upgrade #1
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
Open
yaschete
wants to merge
3
commits into
master
Choose a base branch
from
net6-upgrade
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
Carbon.Sample.API/Application/Consumers/DesiredDataConsumer.cs
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
Carbon.Sample.API/Application/Controllers/BaseController.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| using Carbon.WebApplication; | ||
| using Carbon.WebApplication.TenantManagementHandler.Interfaces; | ||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using System.Collections.Generic; | ||
| using Carbon.Sample.API.Infrastructure.Filters; | ||
|
|
||
| namespace Carbon.Sample.API.Application.Controllers | ||
| { | ||
| [ApiController] | ||
| [Route("api/v1/[controller]")] | ||
| [Authorize(AuthenticationSchemes = "Bearer")] | ||
| [TypeFilter(typeof(BasePropertyBindingActionFilter))] | ||
| public abstract class BaseController : CarbonTenantManagedController | ||
| { | ||
| protected BaseController(List<ISolutionFilteredService> solutionServices, | ||
| List<IOwnershipFilteredService> ownershipFilteres) | ||
| : base(solutionServices, ownershipFilteres) | ||
| { | ||
| } | ||
| } | ||
| } | ||
57 changes: 0 additions & 57 deletions
57
Carbon.Sample.API/Application/Controllers/DataController.cs
This file was deleted.
Oops, something went wrong.
202 changes: 92 additions & 110 deletions
202
Carbon.Sample.API/Application/Controllers/SampleController.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,129 +1,111 @@ | ||
| using Carbon.PagedList; | ||
| using Carbon.Sample.API.Application.Dto; | ||
| using Carbon.Sample.API.Application.Dto; | ||
| using Carbon.Sample.API.Domain.Services.Abstract; | ||
| using Carbon.Sample.API.Infrastructure; | ||
| using Carbon.WebApplication; | ||
| using Carbon.WebApplication.HttpAtrributes; | ||
| using Carbon.WebApplication.TenantManagementHandler.ControllerAttributes; | ||
| using Carbon.WebApplication.TenantManagementHandler.Interfaces; | ||
|
|
||
| using HybridModelBinding; | ||
|
|
||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Net; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Carbon.Sample.API.Application.Controllers | ||
| { | ||
| [ApiController] | ||
| [Route("api/v1/[controller]")] | ||
| [Authorize(AuthenticationSchemes = "Bearer")] | ||
| public class SampleController : CarbonTenantManagedController | ||
| { | ||
| private readonly ISampleService _sampleService; | ||
| public SampleController(ISampleService sampleService) : base(new List<ISolutionFilteredService>() { sampleService }, new List<IOwnershipFilteredService>() { sampleService }) | ||
| { | ||
| _sampleService = sampleService; | ||
| } | ||
| public class SampleController : BaseController | ||
| { | ||
| private readonly ISampleService _sampleService; | ||
|
|
||
| public SampleController(ISampleService sampleService) | ||
| : base(new List<ISolutionFilteredService>() { sampleService }, | ||
| new List<IOwnershipFilteredService>() { sampleService }) | ||
| { | ||
| _sampleService = sampleService; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Get all Samples by filter with Get HTTP Method | ||
| /// </summary> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <param name="sampleFilterDto">Sample Filter</param> | ||
| /// <returns>Sample List</returns> | ||
| [HttpGetCarbon] | ||
| //[Route("GetSamples")] | ||
| [ProducesResponseType((int)HttpStatusCode.NotFound)] | ||
| [ProducesResponseType(typeof(IPagedList<SampleDto>), (int)HttpStatusCode.OK)] | ||
| [ProducesResponseType((int)HttpStatusCode.BadRequest)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Read")] | ||
| public async Task<IActionResult> GetSamples([FromHeader] Guid tenantId, [FromHybrid] SampleFilterDto sampleFilterDto) | ||
| { | ||
| if (tenantId == Guid.Empty) | ||
| throw new SampleException(ErrorCodes.NoTenantSpecified); | ||
| try | ||
| { | ||
| var Samples = await _sampleService.Filter(sampleFilterDto); | ||
| return PagedListOk(Samples); | ||
| } | ||
| catch (KeyNotFoundException) | ||
| { | ||
| return NotFound(); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create Sample | ||
| /// </summary> | ||
| /// <param name="model">Sample creator model</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <returns>Created Sample's Id</returns> | ||
| [HttpPostCarbon] | ||
| //[Route("CreateSample")] | ||
| [ProducesResponseType((int)HttpStatusCode.Created)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Create")] | ||
| public async Task<IActionResult> CreateSample([FromBody] SampleCreateDto model, [FromHeader] Guid tenantId) | ||
| { | ||
| model.TenantId = tenantId; | ||
| var result = await _sampleService.CreateAsync(model); | ||
| /// <summary> | ||
| /// Create Sample | ||
| /// </summary> | ||
| /// <param name="request">Sample filter model</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <returns>Created Sample's Id</returns> | ||
| [HttpPostCarbon] | ||
| [Route("GetAll")] | ||
| [ProducesResponseType((int)HttpStatusCode.OK)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Create")] | ||
| public async Task<IActionResult> GetAllAsync([FromBody] SampleFilterDto request) | ||
| { | ||
| var result = await _sampleService.GetAllAsync(request); | ||
| return Ok(result); | ||
| } | ||
|
|
||
| return CreatedAtAction(nameof(CreateSample), new { id = result.Id }, new { id = result.Id }); | ||
| } | ||
| /// <summary> | ||
| /// Create Sample | ||
| /// </summary> | ||
| /// <param name="request">Sample creator model</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <returns>Created Sample's Id</returns> | ||
| [HttpPostCarbon] | ||
| [ProducesResponseType((int)HttpStatusCode.Created)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Create")] | ||
| public async Task<IActionResult> CreateSample([FromBody] SampleCreateDto request) | ||
| { | ||
| var result = await _sampleService.CreateAsync(request); | ||
| return CreatedAtAction(nameof(CreateSample), new { id = result.Id }, new { id = result.Id }); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Updates Sample | ||
| /// </summary> | ||
| /// <param name="model">Sample updater model</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <param name="id">Updated Sample id</param> | ||
| /// <returns>Sample's last state</returns> | ||
| [HttpPutCarbon] | ||
| [Route("{id:Guid}")] | ||
| [ProducesResponseType((int)HttpStatusCode.BadRequest)] | ||
| [ProducesResponseType((int)HttpStatusCode.OK)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Update")] | ||
| public async Task<IActionResult> UpdateSample([FromBody] SampleUpdateDto model, [FromHeader] Guid tenantId, Guid id) | ||
| { | ||
| model.Id = id; | ||
| model.TenantId = tenantId; | ||
| var result = await _sampleService.UpdateAsync(model); | ||
| return Ok(result); | ||
| } | ||
| /// <summary> | ||
| /// Updates Sample | ||
| /// </summary> | ||
| /// <param name="model">Sample updater model</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <param name="id">Updated Sample id</param> | ||
| /// <returns>Sample's last state</returns> | ||
| [HttpPutCarbon] | ||
| [Route("{id:Guid}")] | ||
| [ProducesResponseType((int)HttpStatusCode.BadRequest)] | ||
| [ProducesResponseType((int)HttpStatusCode.OK)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Update")] | ||
| public async Task<IActionResult> UpdateSample([FromBody] SampleUpdateDto model, [FromHeader] Guid tenantId, | ||
| Guid id) | ||
| { | ||
| model.Id = id; | ||
| model.TenantId = tenantId; | ||
| var result = await _sampleService.UpdateAsync(model); | ||
| return Ok(result); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Deletes the Sample given by id | ||
| /// </summary> | ||
| /// <param name="id">Sample id</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <returns>No Content</returns> | ||
| [HttpDeleteCarbon] | ||
| [Route("{id:Guid}")] | ||
| [ProducesResponseType((int)HttpStatusCode.OK)] | ||
| [ProducesResponseType((int)HttpStatusCode.BadRequest)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Delete")] | ||
| public async Task<IActionResult> DeleteSample([FromBody] SampleDeleteDto model, Guid id, [FromHeader] Guid tenantId) | ||
| { | ||
| model.Id = id; | ||
| model.TenantId = tenantId; | ||
| /// <summary> | ||
| /// Deletes the Sample given by id | ||
| /// </summary> | ||
| /// <param name="id">Sample id</param> | ||
| /// <param name="tenantId">Tenant Id</param> | ||
| /// <returns>No Content</returns> | ||
| [HttpDeleteCarbon] | ||
| [Route("{id:Guid}")] | ||
| [ProducesResponseType((int)HttpStatusCode.OK)] | ||
| [ProducesResponseType((int)HttpStatusCode.BadRequest)] | ||
| [SolutionFilter] | ||
| [OwnershipFilter("Sample_Delete")] | ||
| public async Task<IActionResult> DeleteSample([FromBody] SampleDeleteDto model, Guid id, | ||
| [FromHeader] Guid tenantId) | ||
| { | ||
| model.Id = id; | ||
| model.TenantId = tenantId; | ||
|
|
||
| try | ||
| { | ||
| await _sampleService.DeleteAsync(model); | ||
| return DeletedOk(); | ||
| } | ||
| catch (SampleException ex) | ||
| { | ||
| return BadRequest(ex); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| try | ||
| { | ||
| await _sampleService.DeleteAsync(model); | ||
| return DeletedOk(); | ||
| } | ||
| catch (SampleException ex) | ||
| { | ||
| return BadRequest(ex); | ||
| } | ||
| } | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
Carbon.Sample.API/Application/Dto/Base/BaseRequestPagedDto.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using Carbon.Common; | ||
| using Carbon.WebApplication.TenantManagementHandler.Dtos; | ||
| using Carbon.WebApplication.TenantManagementHandler.Interfaces; | ||
| using Carbon.WebApplication; | ||
| using System.Collections.Generic; | ||
| using Carbon.Sample.API.Settings.Constants; | ||
|
|
||
| namespace Carbon.Sample.API.Application.Dto.Base | ||
| { | ||
| public abstract class BaseRequestDto<T> : RoleFilteredBaseDto<T>, ISolutionFilteredDto where T : class | ||
| { | ||
| public ICollection<EntitySolutionRelationDto> RelationalOwners { get; set; } | ||
| } | ||
| public class BaseRequestPagedDto<T> : BaseRequestDto<T>, IOrderableDto, IPageableDto where T : class | ||
| { | ||
| public IList<Orderable> Orderables { get; set; } | ||
| public int PageSize { get; set; } | ||
| public int PageIndex { get; set; } | ||
|
|
||
| public BaseRequestPagedDto() | ||
| { | ||
| PageSize = ApplicationConstant.DefaultPageSize; | ||
| PageIndex = ApplicationConstant.DefaultIndex; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Route kısmı basede olması sıkıntı olabilir; v1,v2 gibi versiyon bazlı controller ve ya routları yönetmeye başlamamız lazım. Base de olursa hep v1 olarak gidebilir. Bu nedenle route u controller a alıp ilgili kullanımı ile alakalı da ufak bir summary yazarsak süper olur