Skip to content
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

Hl api viewmodel #1015

Open
wants to merge 26 commits into
base: housing-lottery
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
091b64c
initial add roommate completed
ArabellaJi Oct 5, 2023
769d321
update bad naming and return type
ArabellaJi Oct 7, 2023
a18925b
table and code for adding preferred hall
ArabellaJi Oct 22, 2023
e314668
Add senior-project branch to ci-cd.yml
bennettforkner Oct 24, 2023
3652292
get the list of traditional halls
ArabellaJi Oct 29, 2023
ebadbf7
send a list of halls instead of one hall
ArabellaJi Nov 4, 2023
0c9bd4d
change PK of preferred hall table
ArabellaJi Nov 4, 2023
5e9870d
Merge branch 'senior-project' into housing-add-roommate
ArabellaJi Nov 13, 2023
661af11
initial add roommate completed
ArabellaJi Oct 5, 2023
824a21b
Merge pull request #1008 from gordon-cs/to-test-vm
ArabellaJi Nov 13, 2023
f23fa08
change column name
ArabellaJi Nov 13, 2023
3b359bc
Merge pull request #1009 from gordon-cs/to-test-vm
ArabellaJi Nov 13, 2023
e6849af
remove unwanted rows from the table
ArabellaJi Nov 13, 2023
84892fd
Merge branch 'housing-add-roommate' of https://github.com/gordon-cs/g…
ArabellaJi Nov 13, 2023
d38f286
Upgrade to .NET 8
EjPlatzer Nov 17, 2023
150d081
Update CI to build with .NET 8
EjPlatzer Nov 17, 2023
af43295
Merge pull request #1010 from gordon-cs/dotnet8
EjPlatzer Nov 20, 2023
860f9d6
Merge branch 'senior-project' into housing-add-roommate
ArabellaJi Nov 23, 2023
bbd557c
update a couple comments
ArabellaJi Nov 25, 2023
0920d26
Merge branch 'housing-add-roommate' of https://github.com/gordon-cs/g…
ArabellaJi Nov 25, 2023
518447f
Merge branch 'develop' into housing-add-roommate
ArabellaJi Nov 25, 2023
27d3286
revert merging develop because of error
ArabellaJi Nov 25, 2023
27f02f1
Merge branch 'housing-add-roommate' of https://github.com/gordon-cs/g…
ArabellaJi Nov 25, 2023
fce7eee
Merge pull request #1007 from gordon-cs/housing-add-roommate
ArabellaJi Nov 25, 2023
db8751e
receive and send application data to frontend
ArabellaJi Dec 3, 2023
0299cf6
update the warning message
ArabellaJi Dec 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core SDK 6
uses: actions/setup-dotnet@v2
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: '8.x'

- name: Install dependencies
run: dotnet restore
Expand All @@ -31,10 +31,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core SDK 6
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: '8.x'

- name: Install dependencies
run: dotnet restore
Expand All @@ -57,6 +57,35 @@ jobs:
name: Production
url: https://360Api.gordon.edu

steps:
- uses: actions/checkout@v3

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'

- name: Install dependencies
run: dotnet restore

- name: Publish
run: dotnet publish ${{ github.workspace}}\Gordon360.sln -r win-x64 --no-self-contained -p:PublishDir=${{ github.workspace }}\Gordon360\bin\app.publish\ci -p:EnvironmentName=${{ secrets.DEPLOYMENT_ENVIRONMENT }}

- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: build-${{ secrets.DEPLOYMENT_ENVIRONMENT }}
path: ${{ github.workspace }}\Gordon360\bin\app.publish\ci
if-no-files-found: error

deploy-senior-project:
runs-on: windows-latest
if: ${{ github.ref == 'refs/heads/senior-project' }}
needs: build
environment:
name: Senior Project
url: https://360ApiSP.gordon.edu

steps:
- uses: actions/checkout@v3

Expand Down
148 changes: 148 additions & 0 deletions Gordon360/Controllers/HousingController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Gordon360.Authorization;
using Gordon360.Enums;
using Gordon360.Models.CCT;
using Gordon360.Models.CCT.Context;
using Gordon360.Models.ViewModels;
Expand All @@ -8,6 +9,11 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using System.Security.Cryptography.Xml;
using System.Collections.Generic;

namespace Gordon360.Controllers
{
Expand Down Expand Up @@ -63,6 +69,25 @@ public ActionResult<string[]> GetApartmentHalls()
}
}

/// <summary>
/// Get a list of the traditional halls
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("halls/traditionals")]
public ActionResult<string[]> GetTraditionalHalls()
{
var result = _housingService.GetAllTraditionalHalls();
if (result != null)
{
return Ok(result);
}
else
{
return NotFound();
}
}

/// <summary>
/// Get apartment application ID number of currently logged in user if that user is on an existing application
/// </summary>
Expand Down Expand Up @@ -243,5 +268,128 @@ public ActionResult<ApartmentApplicationViewModel[]> GetAllApartmentApplication(
return NotFound();
}
}

/// <summary>
/// Update roommate information
/// </summary>
/// <returns></returns>
[HttpPut]
[Route("housing_lottery/roommate/{applicantion_id}")]
public async Task<ActionResult<string>> UpdateRoommate(string applicantion_id, [FromBody] string[] emailList)
{
var username = AuthUtils.GetUsername(User);
await _housingService.UpdateRoommateAsync(username, applicantion_id, emailList);
return Ok();
}

/// <summary>
/// Update preferred hall information
/// </summary>
/// <returns></returns>
[HttpPut]
[Route("housing_lottery/hall/{applicantion_id}")]
public async Task<ActionResult<string>> UpdatePreferredHall(string applicantion_id, [FromBody] string[] hallList)
{
var username = AuthUtils.GetUsername(User);
await _housingService.UpdateHallAsync(username, applicantion_id, hallList);
return Ok();
}

/// <summary>
/// Update preferred hall information
/// </summary>
/// <returns></returns>
[HttpPut]
[Route("housing_lottery/preference/{applicantion_id}")]
public async Task<ActionResult<string>> UpdatePreference(string applicantion_id, [FromBody] string[] preferenceList)
{
var username = AuthUtils.GetUsername(User);
await _housingService.UpdatePreferenceAsync(username, applicantion_id, preferenceList);
return Ok();
}

/// <summary>
/// Get an array of preferences
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("housing_lottery/all_preference")]
public ActionResult<string[]> GetAllPreference()
{
var viewerGroups = AuthUtils.GetGroups(User);
if (viewerGroups.Contains(AuthGroup.HousingAdmin))
{
var result = _housingService.GetAllPreference();
if (result != null)
{
return Ok(result);
}
return NotFound();
}
return Ok(null);
}

/// <summary>
/// Get an array of preferred halls
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("housing_lottery/all_preferred_hall")]
public ActionResult<string[]> GetAllPreferredHall()
{
var viewerGroups = AuthUtils.GetGroups(User);
if (viewerGroups.Contains(AuthGroup.HousingAdmin))
{
var result = _housingService.GetAllPreferredHall();
if (result != null)
{
return Ok(result);
}
return NotFound();
}
return Ok(null);
}

/// <summary>
/// Get an array of applicant
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("housing_lottery/all_applicant")]
public ActionResult<string[]> GetAllApplicant()
{
var viewerGroups = AuthUtils.GetGroups(User);
if (viewerGroups.Contains(AuthGroup.HousingAdmin))
{
var result = _housingService.GetAllApplicant();
if (result != null)
{
return Ok(result);
}
return NotFound();
}
return Ok(null);
}

/// <summary>
/// Get an array of school years
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("housing_lottery/all_school_year")]
public ActionResult<string[]> GetAllSchoolYear()
{
var viewerGroups = AuthUtils.GetGroups(User);
if (viewerGroups.Contains(AuthGroup.HousingAdmin))
{
var result = _housingService.GetAllSchoolYear();
if (result != null)
{
return Ok(result);
}
return NotFound();
}
return Ok(null);
}
}
}
102 changes: 102 additions & 0 deletions Gordon360/Documentation/Gordon360.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading