Skip to content

Commit

Permalink
Merge pull request #224 from amosproj/develop
Browse files Browse the repository at this point in the history
Release Sprint 14
  • Loading branch information
jantiegges authored Feb 8, 2023
2 parents 337affa + d6f3f3d commit 5b2cea6
Show file tree
Hide file tree
Showing 169 changed files with 7,558 additions and 4,197 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '/Documentation/**'
schedule:
- cron: '15 10 * * 5'

Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,3 @@ jobs:

- name: Build Next.js app
run: yarn build

test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/deskstar-frontend
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3

- name: Install dependencies
run: yarn install

- name: Install playwright browsers
run: yarn run playwright install --with-deps

- name: Test Next App
run: yarn test --reporter github
1 change: 1 addition & 0 deletions Deliverables/sprint-14/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The PDF files of the documentation are generated from the Github wiki. Converting Markdown to PDF causes some formatting issues, so the documentation resources are best viewed on our Github wiki.
Binary file added Deliverables/sprint-14/feature-board.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Deliverables/sprint-14/planning-documents.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Documentation/BuildProcessVideo.mp4
Binary file not shown.
Binary file modified Documentation/Screenshot/addBooking_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/addBooking_page1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/addBooking_page2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/addBooking_page3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/booking_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/index_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/index_page2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Screenshot/logo_christmas.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/Screenshot/logo_christmas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/register_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/resourceManagement_desks_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/resourceManagement_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/user_page_manage_delete_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/user_page_manage_edit_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/user_page_manage_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/Screenshot/user_page_request_only_admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Documentation/architecture.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2023-02-07T17:28:37.230Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" etag="jgJJWZ_7sNsG4wlpJlE1" version="20.8.12" type="device"><diagram id="7461oDI4QgMP68D06WNy" name="Seite-1">7V1fl6K4Ev80fc7eB+cIAcTHtnt6d+6dnZkzPXfv7NM9NEZlB40HYre9n36DAkISNe1AJaI9DyMBAevfr6pSqdygu/n61yRYzn4nYxzf2P3x+gbd39g2cpDD/stGXrcjtmuh7cg0icbbMWs38Bj9jfPBfj66isY4rV1ICYlptKwPhmSxwCGtjQVJQl7ql01IXH/qMphiYeAxDGJx9H/RmM62o7492I3/hqPprHiy5Q23Z+ZBcXH+S9JZMCYvlSH0/gbdJYTQ7af5+g7HGfUKumy/97DnbPliCV5QlS98fwhn8Xf/M/3w4T/J/4erePrxc2+Qv9xzEK/yX5y/LX0tSJCQ1WKMs7v0b9DoZRZ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ele4rdnWZyv7DiayxUchdxKdwDndBVGqthRVIy2PncjrEjwgVUYeD2UKdBxugwVym+MDAlxCbQMqewG1j0YKDeIKMkuWfkOigIqW4ddUeANRSDFPlStowDvx3lqCvzmlrY82njWkQZ6h6+/aadLqELe7wwhqYxVBupRcqtaoOwLAWkBv0pHVQsakzuFUqjuwRhfeu0MdKOYQk7zbFAsV3qrqvFlsgJe55Gy7+rB6HxPwD4P2nkFztUCo40hgqfuckEJntAyBlzwFJK23YObnsXvkqC9blJlo8FzAxxjvEzllaLFxnTtIw6/yM8DzprL9k/sKuIMzgFyoCTP8nRLnkKy1zDIGUcJO7PtP8Ook8leO8UcnmS/O1AY8hSyqGcDQ212JlOdhvVsKL0W02Sweu0BJ37PfxJHGRzAhEjYPAxahhSyrheCDcL8vifbaRYUG4BXacKEKIZEKKp58MJ7a302iJ9Y9IC7kHjAGVjoCRhbvVrMiIXEYII31C14CrlYwzCoAbwRU+Da4aZLbdAMgxvlxsoeUNcrJETC0J5nNzunyTOx5wA3UIIn7LkHLXgX2W0NAUY37DAhhFbZxgg3+52McXbFPw==</diagram></mxfile>
Binary file removed Documentation/architecture.png
Binary file not shown.
1 change: 0 additions & 1 deletion Documentation/deskstar-arch.drawio

This file was deleted.

Binary file added Documentation/swagger/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/swagger/favicon-32x32.png
16 changes: 16 additions & 0 deletions Documentation/swagger/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after {
box-sizing: inherit;
}

body {
margin: 0;
background: #fafafa;
}
79 changes: 79 additions & 0 deletions Documentation/swagger/oauth2-redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;

if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}

arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};

isValid = qp.state === sentState;

if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}

if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}

oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}

if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>
20 changes: 20 additions & 0 deletions Documentation/swagger/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: "swagger.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});

//</editor-fold>
};
3 changes: 3 additions & 0 deletions Documentation/swagger/swagger-ui-bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Documentation/swagger/swagger-ui-es-bundle-core.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui-es-bundle-core.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Documentation/swagger/swagger-ui-es-bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui-es-bundle.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Documentation/swagger/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui-standalone-preset.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Documentation/swagger/swagger-ui.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui.css.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Documentation/swagger/swagger-ui.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Documentation/swagger/swagger-ui.js.map

Large diffs are not rendered by default.

Binary file added architecture.png
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="Documentation/swagger/swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="Documentation/swagger/index.css" />
<link rel="icon" type="image/png" href="Documentation/swagger/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="Documentation/swagger/favicon-16x16.png" sizes="16x16" />
</head>

<body>
<div id="swagger-ui"></div>
<script src="Documentation/swagger/swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="Documentation/swagger/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="Documentation/swagger/swagger-initializer.js" charset="UTF-8"> </script>
</body>

</html>
37 changes: 17 additions & 20 deletions src/deskstar-backend/Deskstar/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Deskstar.Core.Exceptions;
using Deskstar.Entities;
using Deskstar.Models;
using Deskstar.Usecases;
using Microsoft.AspNetCore.Authorization;
Expand All @@ -12,9 +11,9 @@ namespace Deskstar.Controllers;
[Produces("text/plain")]
public class AuthController : ControllerBase
{
private readonly ILogger<AuthController> _logger;
private readonly IAuthUsecases _authUsecases;
private readonly IConfiguration _configuration;
private readonly ILogger<AuthController> _logger;

public AuthController(ILogger<AuthController> logger, IAuthUsecases authUsecases, IConfiguration configuration)
{
Expand All @@ -24,14 +23,13 @@ public AuthController(ILogger<AuthController> logger, IAuthUsecases authUsecases
}

/// <summary>
/// Login functionality
/// Login functionality
/// </summary>
/// <returns> JWT, if users is approved and psw is correct </returns>
/// <remarks>
/// Sample request:
/// Post /auth/createToken
/// Sample request:
/// Post /auth/createToken
/// </remarks>
///
/// <response code="200">Login succesful </response>
/// <response code="401">Credentials wrong or user not approved</response>
[HttpPost("createToken")]
Expand All @@ -41,22 +39,18 @@ public AuthController(ILogger<AuthController> logger, IAuthUsecases authUsecases
public IActionResult CreateToken(CreateTokenUser user)
{
var returnValue = _authUsecases.CheckCredentials(user.MailAddress, user.Password);
if (returnValue.Message == LoginReturn.Ok)
{
return Ok(_authUsecases.CreateToken(_configuration, user.MailAddress));
}
if (returnValue.Message == LoginReturn.Ok) return Ok(_authUsecases.CreateToken(_configuration, user.MailAddress));

return Unauthorized(returnValue.Message.ToString());
}

/// <summary>
/// Register functionality
/// Register functionality
/// </summary>
/// <remarks>
/// Sample request:
/// Post /auth/register
/// Sample request:
/// Post /auth/register
/// </remarks>
///
/// <response code="200">User added to db</response>
/// <response code="400">Mail already in use</response>
/// <response code="404">Company not found</response>
Expand All @@ -75,14 +69,14 @@ public IActionResult Register(RegisterUser registerUser)
_ => BadRequest(result.Message.ToString())
};
}

/// <summary>
/// Register functionality
/// Register functionality
/// </summary>
/// <remarks>
/// Sample request:
/// Post /auth/registerAdmin
/// Sample request:
/// Post /auth/registerAdmin
/// </remarks>
///
/// <response code="200">Admin added to db</response>
/// <response code="400">Mail or Company name already in use</response>
[HttpPost("registerAdmin")]
Expand All @@ -93,7 +87,10 @@ public IActionResult RegisterAdmin(RegisterAdminDto registerAdmin)
{
try
{
var admin = _authUsecases.RegisterAdmin(registerAdmin.FirstName, registerAdmin.LastName, registerAdmin.MailAddress, registerAdmin.Password, registerAdmin.CompanyName);
var admin = _authUsecases.RegisterAdmin(registerAdmin.FirstName, registerAdmin.LastName,
registerAdmin.MailAddress, registerAdmin.Password, registerAdmin.CompanyName);
_authUsecases.SendInitialAdminEmail(_configuration["EMAIL:ADDRESS"], admin.Company.CompanyName,
admin.MailAddress);
return Ok();
}
catch (ArgumentInvalidException e)
Expand All @@ -102,7 +99,7 @@ public IActionResult RegisterAdmin(RegisterAdminDto registerAdmin)
}
catch (Exception e)
{
return Problem(statusCode: 500, detail:e.Message);
return Problem(statusCode: 500, detail: e.Message);
}
}
}
Loading

0 comments on commit 5b2cea6

Please sign in to comment.