Skip to content

Commit

Permalink
Merge pull request #233 from SCCapstone/main
Browse files Browse the repository at this point in the history
Merge main into prod
  • Loading branch information
evan-scales authored Jan 25, 2024
2 parents 797ad05 + c568d65 commit 1706dd2
Show file tree
Hide file tree
Showing 50 changed files with 1,785 additions and 962 deletions.

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Builds, runs tests, publishes artifacts

name: Build ForcesUnite

on: push

jobs:
build-api:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
include-prerelease: true

- name: Build with .NET
run: |
cd FU.API
dotnet build
shell: pwsh

- name: Publish
run: |
cd FU.API
dotnet publish
shell: pwsh

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .net-app
path: D:\a\PalmettoProgrammers\PalmettoProgrammers\FU.API\FU.API\bin

- name: Test
run: |
cd FU.API
dotnet test
shell: pwsh

build-spa:
runs-on: windows-latest

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: |
cd FU.SPA
npm ci
- name: Run linter
run: |
cd FU.SPA
npm run lint
- name: Check formatting
run: |
cd FU.SPA
npm run format-check
104 changes: 104 additions & 0 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Builds and deploys API and SPA to Azure

name: Release

on:
push:
branches:
- prod

jobs:
build-api:
name: Build API Job
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
include-prerelease: true

- name: Build with .NET
run: |
cd FU.API
dotnet build --configuration Release
shell: pwsh

- name: Publish
run: |
cd FU.API
dotnet publish -c Release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: .net-app
path: D:\a\PalmettoProgrammers\PalmettoProgrammers\FU.API\FU.API\bin

deploy-api:
name: Deploy API Job
runs-on: windows-latest
needs: build-api
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT

steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: .net-app

- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_87D22017AF9A4422BFA98ED1ADF7422D }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_1C7528FFBA32419CB7F9CE5531B3980E }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_1AD9A60BDBC9485E80D6B3728DDF6729 }}

- name: Deploy API
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'fuapi'
slot-name: 'Production'
package: .

build-and-deploy-spa:
name: Build & Deploy SPA Job
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false

- name: Build and Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_JOLLY_GLACIER_0AE92C40F }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/FU.SPA" # App source code path
output_location: "dist"

comment:
name: Comment on Merge Request
runs-on: ubuntu-latest
needs: [deploy-api, build-and-deploy-spa]

steps:
- uses: actions/checkout@v4

- name: Comment on Merge Request
run: |
branch_name=$(echo "${{ github.event.head_ref }}" | sed 's/refs\/heads\///')
gh pr comment $branch_name -b "Deployed to https://jolly-glacier-0ae92c40f.4.azurestaticapps.net/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/tests-workflow.yml

This file was deleted.

49 changes: 34 additions & 15 deletions FU.API/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# SA1633: File should have header
dotnet_diagnostic.SA1633.severity = none

# Xml Comment Analysis Disabled warning
dotnet_diagnostic.SA0001.severity = none

# KeywordsMustBeSpacedCorrectly
# disabled because conflicts with formatter
# should never happed if using a formatter anyways
dotnet_diagnostic.SA1000.severity = none

# SA1201: Elements should appear in the correct order
dotnet_diagnostic.SA1201.severity = none

Expand All @@ -13,21 +21,23 @@ dotnet_diagnostic.SA1600.severity = none
# SA1413: Use trailing comma in multi-line initializers
dotnet_diagnostic.SA1413.severity = none
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_using_directive_placement = inside_namespace
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_prefer_braces = true
csharp_style_namespace_declarations = file_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = true
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
dotnet_diagnostic.IDE0007.severity = none
dotnet_diagnostic.IDE0008.severity = none
csharp_space_around_binary_operators = before_and_after

[*.{cs,vb}]
Expand Down Expand Up @@ -84,10 +94,19 @@ end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_auto_properties = true
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion

# SA:1602 Disable enumeration documentation
dotnet_diagnostic.SA1602.severity = none
dotnet_diagnostic.SA1602.severity = none

# Disable langauge rules
dotnet_diagnostic.CA1303.severity = none
dotnet_diagnostic.CA1304.severity = none
dotnet_diagnostic.CA1311.severity = none
dotnet_diagnostic.CA1305.severity = none

# disable style rules so they don't overlap with stylecop
dotnet_analyzer_diagnostic.category-Style.severity = none
6 changes: 2 additions & 4 deletions FU.API/FU.API/Controllers/SearchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ namespace FU.API.Controllers;

using FU.API.DTOs.Post;
using FU.API.DTOs.Search;
using FU.API.Exceptions;
using FU.API.Helpers;
using FU.API.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

[ApiController]
Expand All @@ -24,7 +22,7 @@ public SearchController(ISearchService searchService)
public async Task<IActionResult> SearchPosts([FromQuery] PostSearchRequestDTO request)
{
var posts = await _searchService.SearchPosts(request.ToPostQuery());
var response = new List<PostResponseDTO>(posts.Count());
var response = new List<PostResponseDTO>(posts.Count);

// Go through each post and check if the user has joined the post
var user = await _searchService.GetCurrentUser(User);
Expand All @@ -44,4 +42,4 @@ public async Task<IActionResult> SearchPosts([FromQuery] PostSearchRequestDTO re

return Ok(response);
}
}
}
28 changes: 14 additions & 14 deletions FU.API/FU.API/DTOs/Group/GroupSimpleDTO.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
namespace FU.API.DTOs.Group;

public class GroupSimpleDTO
{
public int Id { get; set; }

public string Name { get; set; } = string.Empty;

public string? Description { get; set; }

public int ChatId { get; set; }

public ICollection<string> Tags { get; set; } = new HashSet<string>();
}
namespace FU.API.DTOs.Group;

public class GroupSimpleDTO
{
public int Id { get; set; }

public string Name { get; set; } = string.Empty;

public string? Description { get; set; }

public int ChatId { get; set; }

public ICollection<string> Tags { get; set; } = new HashSet<string>();
}
Loading

0 comments on commit 1706dd2

Please sign in to comment.