diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..62d4322 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,82 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + - master + - dev + - feature/** + +jobs: + dotnet-format: + name: dotnet format + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Restore + run: dotnet restore ./JobFlow.API/JobFlow.API.csproj + + - name: Verify formatting + run: dotnet format ./JobFlow.API/JobFlow.API.csproj --verify-no-changes --verbosity minimal + + dependency-review: + name: Dependency review + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Dependency review + uses: actions/dependency-review-action@v4 + continue-on-error: true + + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Restore + run: dotnet restore ./JobFlow.API/JobFlow.API.csproj + + - name: Build + run: dotnet build ./JobFlow.API/JobFlow.API.csproj -c Release --no-restore + + test: + name: Test + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Restore + run: dotnet restore ./JobFlow.API/JobFlow.API.csproj + + - name: Test + run: dotnet test ./JobFlow.API/JobFlow.API.csproj -c Release --no-build diff --git a/.github/workflows/master_jobflow-api.yml b/.github/workflows/master_jobflow-api.yml index 83ad6e7..65aa19c 100644 --- a/.github/workflows/master_jobflow-api.yml +++ b/.github/workflows/master_jobflow-api.yml @@ -21,7 +21,7 @@ jobs: - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.x' + dotnet-version: '10.0.x' - name: Build with dotnet run: dotnet build JobFlow.API/JobFlow.API.csproj --configuration Release diff --git a/JobFlow.API/Controllers/AuthController.cs b/JobFlow.API/Controllers/AuthController.cs index ee51f64..7341444 100644 --- a/JobFlow.API/Controllers/AuthController.cs +++ b/JobFlow.API/Controllers/AuthController.cs @@ -210,7 +210,7 @@ public async Task DeleteAccount(string uid) return BadRequest(new { Message = "Failed to delete user.", Error = ex.Message }); } } - + } // ============================================================ diff --git a/JobFlow.API/Controllers/InvoiceComtroller.cs b/JobFlow.API/Controllers/InvoiceComtroller.cs index 46ffa25..4a770dd 100644 --- a/JobFlow.API/Controllers/InvoiceComtroller.cs +++ b/JobFlow.API/Controllers/InvoiceComtroller.cs @@ -72,7 +72,7 @@ public async Task Upsert( var invoiceNumber = await numberGenerator.GenerateAsync(organizationId); var jobInfo = await this._jobService.GetJobByIdAsync(request.JobId, organizationId); - + request.OrganizationClientId = jobInfo.Value.OrganizationClientId; var invoice = request.ToInvoice(invoiceNumber); invoice.OrganizationId = organizationId; diff --git a/JobFlow.API/Controllers/JobController.cs b/JobFlow.API/Controllers/JobController.cs index f8fad23..f557d95 100644 --- a/JobFlow.API/Controllers/JobController.cs +++ b/JobFlow.API/Controllers/JobController.cs @@ -63,7 +63,7 @@ public async Task UpsertJob([FromBody] JobDto model) return Unauthorized("Organization context missing."); var mappedJob = _mapper.Map(model); - + var result = await _jobService.UpsertJobAsync(mappedJob, orgId); if (result.IsFailure) @@ -85,7 +85,7 @@ public async Task DeleteJob(Guid id) return NoContent(); } - + [HttpGet("all")] public async Task GetJobs() { @@ -97,6 +97,6 @@ public async Task GetJobs() return Ok(result.Value); } - + } \ No newline at end of file diff --git a/JobFlow.API/Controllers/PaymentController.cs b/JobFlow.API/Controllers/PaymentController.cs index b08de7c..9befecb 100644 --- a/JobFlow.API/Controllers/PaymentController.cs +++ b/JobFlow.API/Controllers/PaymentController.cs @@ -311,7 +311,7 @@ public async Task SetDefaultPaymentMethod([FromBody] SetDefaultPa return result.IsSuccess ? Ok() : BadRequest(result.Error); } - + [HttpPost("webhook")] public async Task HandleStripeWebhook() diff --git a/JobFlow.API/JobFlow.API.csproj b/JobFlow.API/JobFlow.API.csproj index 9fc8fd1..001b617 100644 --- a/JobFlow.API/JobFlow.API.csproj +++ b/JobFlow.API/JobFlow.API.csproj @@ -47,4 +47,8 @@ + + + + diff --git a/JobFlow.API/Mappings/InvoiceMappingExtensions.cs b/JobFlow.API/Mappings/InvoiceMappingExtensions.cs index 23ad349..1272436 100644 --- a/JobFlow.API/Mappings/InvoiceMappingExtensions.cs +++ b/JobFlow.API/Mappings/InvoiceMappingExtensions.cs @@ -45,8 +45,8 @@ public static InvoiceDto ToDto(this Invoice invoice) AmountPaid = invoice.AmountPaid, BalanceDue = invoice.BalanceDue, Status = invoice.Status, - ExternalPaymentId = invoice.ExternalPaymentId, - + ExternalPaymentId = invoice.ExternalPaymentId, + LineItems = invoice.LineItems.Select(li => li.ToDto()).ToList() }; } diff --git a/JobFlow.API/Mappings/MapsterConfig.cs b/JobFlow.API/Mappings/MapsterConfig.cs index dfed639..8073cba 100644 --- a/JobFlow.API/Mappings/MapsterConfig.cs +++ b/JobFlow.API/Mappings/MapsterConfig.cs @@ -40,10 +40,10 @@ public void Register(TypeAdapterConfig config) //InvoiceLineItem → DTO config.NewConfig(); - + //Job → DTO config.NewConfig(); - + config.NewConfig(); //DTO → Job config.NewConfig();