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

Api overhaul #87

Merged
merged 71 commits into from
Nov 15, 2024
Merged

Api overhaul #87

merged 71 commits into from
Nov 15, 2024

Conversation

Sebbben
Copy link
Contributor

@Sebbben Sebbben commented Oct 29, 2024

No description provided.

yrjarv and others added 24 commits September 20, 2024 11:12
Related to cybernetisk#42
We risk issues when name is long or if the user has multiple first names ("Per Ole Hansen" will be shown as "Per" and not "Per Ole")
Remove hard width limit for the LoginButton text, allow the Grid containing LoginButton to shrink to the appropriate size for the length of the text inside LoginButton
Awaits prismaRequest, then reloads the entire page. This 1) confirms to the user that something happened, and 2) updates AppBar to ensure the first name is always correct.
I could not get router.refresh() to work, so window.location.reload() is the best replacement I could find.
First name instead of 'Profile' in right corner of header
Manually replaces "About CYB" with "About" on mobile
commit 0f096c0
Merge: a1ce2ec 4dfd6f8
Author: Tepohe <[email protected]>
Date:   Thu Oct 10 14:42:19 2024 +0200

    Merge branch 'main' into development

commit a1ce2ec
Merge: 4f7d813 f06a472
Author: Tepohe <[email protected]>
Date:   Tue Oct 8 13:53:44 2024 +0200

    Merge branch 'pr/53' into development

commit f06a472
Author: Sebbben <[email protected]>
Date:   Mon Oct 7 16:47:03 2024 +0200

    Fixed wrong path for nav bar home from pointing to /home to pointing to /

commit 0d154f5
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 14:40:51 2024 +0200

    Renamed some directories to take advantage of nexts routing for more usable url paths

Co-Authored-By: Sebbben <[email protected]>
commit d26bd3f
Merge: 0f096c0 c019c46
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 10 16:54:40 2024 +0200

    Merge pull request cybernetisk#67 from Sebbben/fixNoResultMembershipSearch

    Fix no result membership search

commit c019c46
Author: Sebbben <[email protected]>
Date:   Sat Oct 5 16:20:01 2024 +0200

    Made tables turn to first page when the table content changes with a search

commit 0f096c0
Merge: a1ce2ec 4dfd6f8
Author: Tepohe <[email protected]>
Date:   Thu Oct 10 14:42:19 2024 +0200

    Merge branch 'main' into development

commit a1ce2ec
Merge: 4f7d813 f06a472
Author: Tepohe <[email protected]>
Date:   Tue Oct 8 13:53:44 2024 +0200

    Merge branch 'pr/53' into development

commit f06a472
Author: Sebbben <[email protected]>
Date:   Mon Oct 7 16:47:03 2024 +0200

    Fixed wrong path for nav bar home from pointing to /home to pointing to /

commit 0d154f5
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 14:40:51 2024 +0200

    Renamed some directories to take advantage of nexts routing for more usable url paths

Co-Authored-By: Sebbben <[email protected]>
commit f0bacbb
Merge: d26bd3f d198b94
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 17 15:46:05 2024 +0200

    Merge pull request cybernetisk#75 from Borgarsy/feature-halloween-theme

    Temporary Halloween theme

commit d26bd3f
Merge: 0f096c0 c019c46
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 10 16:54:40 2024 +0200

    Merge pull request cybernetisk#67 from Sebbben/fixNoResultMembershipSearch

    Fix no result membership search

commit c019c46
Author: Sebbben <[email protected]>
Date:   Sat Oct 5 16:20:01 2024 +0200

    Made tables turn to first page when the table content changes with a search

commit 0f096c0
Merge: a1ce2ec 4dfd6f8
Author: Tepohe <[email protected]>
Date:   Thu Oct 10 14:42:19 2024 +0200

    Merge branch 'main' into development

commit d198b94
Author: Borgar <[email protected]>
Date:   Tue Oct 8 15:01:29 2024 +0200

    adds halloween theme.

commit a1ce2ec
Merge: 4f7d813 f06a472
Author: Tepohe <[email protected]>
Date:   Tue Oct 8 13:53:44 2024 +0200

    Merge branch 'pr/53' into development

commit f06a472
Author: Sebbben <[email protected]>
Date:   Mon Oct 7 16:47:03 2024 +0200

    Fixed wrong path for nav bar home from pointing to /home to pointing to /

commit 0d154f5
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 14:40:51 2024 +0200

    Renamed some directories to take advantage of nexts routing for more usable url paths

Co-Authored-By: Borgarsy <[email protected]>
commit 8b529ef
Author: Tepohe <[email protected]>
Date:   Thu Oct 17 16:20:05 2024 +0200

    Updated incorrect url-path

commit 73999a8
Merge: f0bacbb 1861431
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 17 16:11:36 2024 +0200

    git push origin developmentMerge branch 'Sebbben-featureBetterRegisterFeedback' into development
    Handled merge-conflict for pr/64

commit 1861431
Merge: f0bacbb cd922ac
Author: Tepohe <[email protected]>
Date:   Thu Oct 17 16:08:02 2024 +0200

    Handled merge-conflict

commit f0bacbb
Merge: d26bd3f d198b94
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 17 15:46:05 2024 +0200

    Merge pull request cybernetisk#75 from Borgarsy/feature-halloween-theme

    Temporary Halloween theme

commit cd922ac
Author: Sebbben <[email protected]>
Date:   Fri Oct 11 10:20:45 2024 +0200

    made it so that pressing enter on signin and register page submits the forms

commit 56dc570
Author: Sebbben <[email protected]>
Date:   Fri Oct 11 10:16:44 2024 +0200

    removed duplicate login button on successfull registration

commit d26bd3f
Merge: 0f096c0 c019c46
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 10 16:54:40 2024 +0200

    Merge pull request cybernetisk#67 from Sebbben/fixNoResultMembershipSearch

    Fix no result membership search

commit c019c46
Author: Sebbben <[email protected]>
Date:   Sat Oct 5 16:20:01 2024 +0200

    Made tables turn to first page when the table content changes with a search

commit 0f096c0
Merge: a1ce2ec 4dfd6f8
Author: Tepohe <[email protected]>
Date:   Thu Oct 10 14:42:19 2024 +0200

    Merge branch 'main' into development

commit d198b94
Author: Borgar <[email protected]>
Date:   Tue Oct 8 15:01:29 2024 +0200

    adds halloween theme.

commit a1ce2ec
Merge: 4f7d813 f06a472
Author: Tepohe <[email protected]>
Date:   Tue Oct 8 13:53:44 2024 +0200

    Merge branch 'pr/53' into development

commit f06a472
Author: Sebbben <[email protected]>
Date:   Mon Oct 7 16:47:03 2024 +0200

    Fixed wrong path for nav bar home from pointing to /home to pointing to /

commit a715fac
Author: Sebbben <[email protected]>
Date:   Tue Oct 1 17:24:53 2024 +0200

    added snackbar to singin page

commit 6322071
Merge: 131cc76 ea38e61
Author: Sebbben <[email protected]>
Date:   Tue Oct 1 17:08:07 2024 +0200

    Merged features from featureBetterRegisterFeedback into changes made by pvk05's fixRegisterUserResponse

commit 131cc76
Merge: 221a968 eb8b2f2
Author: Philip Knudsen <[email protected]>
Date:   Tue Oct 1 16:32:52 2024 +0200

    Merge branch 'cybernetisk:main' into fixRegisterUserResponse

commit 221a968
Author: pvk05 <[email protected]>
Date:   Sat Sep 28 00:57:24 2024 +0200

    moved register response to a snackbar for better visual feedback

commit ea38e61
Author: Sebbben <[email protected]>
Date:   Fri Sep 27 23:41:22 2024 +0200

    added loading indicator to singin page as well

commit 8a3d2de
Author: pvk05 <[email protected]>
Date:   Fri Sep 27 23:14:48 2024 +0200

    checks if email includes "@" before registering user

commit 3f547cf
Author: pvk05 <[email protected]>
Date:   Fri Sep 27 22:44:11 2024 +0200

    fixed response from sendMail function to send correct feedback when failing

commit 0b33808
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 17:07:50 2024 +0200

    visual queue when registering user

commit 0d154f5
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 14:40:51 2024 +0200

    Renamed some directories to take advantage of nexts routing for more usable url paths

Co-Authored-By: Philip Knudsen <[email protected]>
Co-Authored-By: Sebbben <[email protected]>
commit cbe876a
Merge: 8b529ef ac17a6e
Author: Eric Svebakk <[email protected]>
Date:   Mon Oct 28 16:24:24 2024 +0100

    Merge pull request cybernetisk#82 from Sebbben/moveBoardPage

    Move board page

commit ac17a6e
Author: Sebbben <[email protected]>
Date:   Fri Oct 25 10:54:13 2024 +0200

    moved pages/main/board/* to (pages)/(main)/board

commit 8b529ef
Author: Tepohe <[email protected]>
Date:   Thu Oct 17 16:20:05 2024 +0200

    Updated incorrect url-path

commit 73999a8
Merge: f0bacbb 1861431
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 17 16:11:36 2024 +0200

    git push origin developmentMerge branch 'Sebbben-featureBetterRegisterFeedback' into development
    Handled merge-conflict for pr/64

commit 1861431
Merge: f0bacbb cd922ac
Author: Tepohe <[email protected]>
Date:   Thu Oct 17 16:08:02 2024 +0200

    Handled merge-conflict

commit f0bacbb
Merge: d26bd3f d198b94
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 17 15:46:05 2024 +0200

    Merge pull request cybernetisk#75 from Borgarsy/feature-halloween-theme

    Temporary Halloween theme

commit cd922ac
Author: Sebbben <[email protected]>
Date:   Fri Oct 11 10:20:45 2024 +0200

    made it so that pressing enter on signin and register page submits the forms

commit 56dc570
Author: Sebbben <[email protected]>
Date:   Fri Oct 11 10:16:44 2024 +0200

    removed duplicate login button on successfull registration

commit d26bd3f
Merge: 0f096c0 c019c46
Author: Eric Svebakk <[email protected]>
Date:   Thu Oct 10 16:54:40 2024 +0200

    Merge pull request cybernetisk#67 from Sebbben/fixNoResultMembershipSearch

    Fix no result membership search

commit c019c46
Author: Sebbben <[email protected]>
Date:   Sat Oct 5 16:20:01 2024 +0200

    Made tables turn to first page when the table content changes with a search

commit 0f096c0
Merge: a1ce2ec 4dfd6f8
Author: Tepohe <[email protected]>
Date:   Thu Oct 10 14:42:19 2024 +0200

    Merge branch 'main' into development

commit d198b94
Author: Borgar <[email protected]>
Date:   Tue Oct 8 15:01:29 2024 +0200

    adds halloween theme.

commit a1ce2ec
Merge: 4f7d813 f06a472
Author: Tepohe <[email protected]>
Date:   Tue Oct 8 13:53:44 2024 +0200

    Merge branch 'pr/53' into development

commit f06a472
Author: Sebbben <[email protected]>
Date:   Mon Oct 7 16:47:03 2024 +0200

    Fixed wrong path for nav bar home from pointing to /home to pointing to /

commit a715fac
Author: Sebbben <[email protected]>
Date:   Tue Oct 1 17:24:53 2024 +0200

    added snackbar to singin page

commit 6322071
Merge: 131cc76 ea38e61
Author: Sebbben <[email protected]>
Date:   Tue Oct 1 17:08:07 2024 +0200

    Merged features from featureBetterRegisterFeedback into changes made by pvk05's fixRegisterUserResponse

commit 131cc76
Merge: 221a968 eb8b2f2
Author: Philip Knudsen <[email protected]>
Date:   Tue Oct 1 16:32:52 2024 +0200

    Merge branch 'cybernetisk:main' into fixRegisterUserResponse

commit 221a968
Author: pvk05 <[email protected]>
Date:   Sat Sep 28 00:57:24 2024 +0200

    moved register response to a snackbar for better visual feedback

commit ea38e61
Author: Sebbben <[email protected]>
Date:   Fri Sep 27 23:41:22 2024 +0200

    added loading indicator to singin page as well

commit 8a3d2de
Author: pvk05 <[email protected]>
Date:   Fri Sep 27 23:14:48 2024 +0200

    checks if email includes "@" before registering user

commit 3f547cf
Author: pvk05 <[email protected]>
Date:   Fri Sep 27 22:44:11 2024 +0200

    fixed response from sendMail function to send correct feedback when failing

commit 0b33808
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 17:07:50 2024 +0200

    visual queue when registering user

commit 0d154f5
Author: Sebbben <[email protected]>
Date:   Thu Sep 26 14:40:51 2024 +0200

    Renamed some directories to take advantage of nexts routing for more usable url paths

Co-Authored-By: Sebbben <[email protected]>
@Sebbben Sebbben self-assigned this Oct 29, 2024
@EricSvebakk EricSvebakk linked an issue Oct 29, 2024 that may be closed by this pull request
@Sebbben Sebbben changed the base branch from main to development October 29, 2024 20:01
Copy link
Member

@pvk05 pvk05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some small changes needed, but almost complete

@@ -0,0 +1,5 @@
import { NextResponse } from "next/server";

export async function middleware(req) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused function

@@ -28,7 +28,7 @@ const NavItems = [
},
];

export default function AppLayout({ children }) {
export default async function AppLayout({ children }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove async from client component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused middleware function


const handleUpdateData = async () => {

await fetch(`/api/v2/users/${session.data.user.id}`, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite to use fetch.then

data: {
recruitedById: selectedRecruiter.id,
},
await fetch(`/api/v2/users/${session.data.user.id}`, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrite to fetch.then

middleware.js Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused middleware

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused

* @param {string[]} requiredRoles List of roles required to access page, pass empty list to require user to be logged in
* @returns {Auth}
*/
requireRoles(requiredRoles) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add admin bypass

const authCheck = new Auth(session)
.requireRoles([])

authCheck.requireOwnership(userID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be chained?

@Sebbben Sebbben marked this pull request as ready for review November 11, 2024 19:58
@Sebbben Sebbben requested a review from EricSvebakk November 11, 2024 19:59
@Sebbben Sebbben merged commit 2009232 into cybernetisk:development Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor PrismaRequest middleware
4 participants