Skip to content

Commit

Permalink
Improve file/folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
JorWo committed May 25, 2024
1 parent f167a29 commit 2eb08d1
Show file tree
Hide file tree
Showing 48 changed files with 118 additions and 118 deletions.
2 changes: 1 addition & 1 deletion ui/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config: Config = {
customExportConditions: []
},
setupFilesAfterEnv: [
'<rootDir>/tests/setupJest.ts'
'<rootDir>/tests/setup-jest.ts'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleDirectories: ['node_modules', '<rootDir>'],
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"predev": "node api-handshake.js",
"dev": "next dev -p 8080",
"dev": "next dev -p 8080 --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/access/Session.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import User from './User';
import User from './user';

export interface SessionData {
user: User;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/access/User.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MemberResult } from '@/groupings/GroupingsApiResults';
import Role from './Role';
import Role from './role';

type User = {
roles: Role[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import { cookies } from 'next/headers';
import { redirect } from 'next/navigation';
import { IronSession, getIronSession } from 'iron-session';
import { SessionData, SessionOptions } from './Session';
import User, { AnonymousUser } from './User';
import { validateTicket } from './Saml11Validator';
import { setRoles } from './AuthorizationService';
import { SessionData, SessionOptions } from './session';
import User, { AnonymousUser } from './user';
import { validateTicket } from './saml-11-validator';
import { setRoles } from './authorization';
import { isDeepStrictEqual } from 'util';

const casUrl = process.env.NEXT_PUBLIC_CAS_URL as string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use server';

import User from './User';
import Role from './Role';
import User from './user';
import Role from './role';

const apiBaseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import User, { AnonymousUser } from './User';
import User, { AnonymousUser } from './user';
import uniqid from 'uniqid';
import { format } from 'util';
import { transform } from 'camaro';
Expand Down
6 changes: 3 additions & 3 deletions ui/src/services/EmailService.ts → ui/src/actions/email.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use server';

import { getCurrentUser } from '@/access/AuthenticationService';
import { ApiError } from '@/groupings/GroupingsApiResults';
import { postRequest } from './FetchService';
import { getCurrentUser } from '@/access/authentication';
import { ApiError } from '@/models/groupings-api-results';
import { postRequest } from './http-fetch';

const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL as string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use server';

import { getCurrentUser } from '@/access/AuthenticationService';
import { getCurrentUser } from '@/access/authentication';
import {
Announcements,
ApiError,
Expand All @@ -19,7 +19,7 @@ import {
GroupingUpdateDescriptionResult,
MemberAttributeResults,
MembershipResults
} from '../groupings/GroupingsApiResults';
} from '../models/groupings-api-results';
import {
deleteRequest,
deleteRequestAsync,
Expand All @@ -29,7 +29,7 @@ import {
postRequestRetry,
putRequest,
putRequestAsync
} from './FetchService';
} from './http-fetch';

const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use server';

import { ApiError } from '../groupings/GroupingsApiResults';
import { getCurrentUser } from '@/access/AuthenticationService';
import { sendStackTrace } from './EmailService';
import { ApiError } from '@/models/groupings-api-results';
import { getCurrentUser } from '@/access/authentication';
import { sendStackTrace } from './email';

const maxRetries = 3;
const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string;
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/(index)/_components/Announcements.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { AlertCircle } from 'lucide-react';
import { getAnnouncements } from '@/services/GroupingsApiService';
import { getAnnouncements } from '@/actions/groupings-api';

const Announcements = async () => {
const announcements = await getAnnouncements();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Role from '@/access/Role';
import Role from '@/access/role';
import Image from 'next/image';
import { KeyRound } from 'lucide-react';
import Link from 'next/link';
import { Button } from '@/components/ui/button';
import { getNumberOfGroupings, getNumberOfMemberships } from '@/services/GroupingsApiService';
import { getCurrentUser } from '@/access/AuthenticationService';
import { getNumberOfGroupings, getNumberOfMemberships } from '@/actions/groupings-api';
import { getCurrentUser } from '@/access/authentication';

const AfterLogin = async ()=>{
const [currentUser, numberOfGroupings, numberOfMemberships] = await Promise.all([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from '@/components/ui/button';
import { ArrowRight } from 'lucide-react';
import UHGroupingsInfo from '@/components/UHGroupingsInfo';
import UHGroupingsInfo from '@/components/uh-groupings-info';

const BeforeLogin = () => (
<main className="bg-seafoam pb-10">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';
import { Button } from '@/components/ui/button';
import Role from '@/access/Role';
import User from '@/access/User';
import { login, logout } from '@/access/AuthenticationService';
import Role from '@/access/role';
import User from '@/access/user';
import { login, logout } from '@/access/authentication';

const LoginButton = ({
currentUser
Expand Down
12 changes: 6 additions & 6 deletions ui/src/app/(index)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Image from 'next/image';
import BeforeLogin from '@/app/(index)/_components/BeforeLogin';
import AfterLogin from '@/app/(index)/_components/AfterLogin';
import { getCurrentUser } from '@/access/AuthenticationService';
import Role from '@/access/Role';
import LoginButton from '@/app/(index)/_components/LoginButton';
import Announcements from '@/app/(index)/_components/Announcements';
import BeforeLogin from '@/app/(index)/_components/before-login';
import AfterLogin from '@/app/(index)/_components/after-login';
import { getCurrentUser } from '@/access/authentication';
import Role from '@/access/role';
import LoginButton from '@/app/(index)/_components/login-button';
import Announcements from '@/app/(index)/_components/announcements';

const Home = async () => {
const currentUser = await getCurrentUser();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import UHGroupingsInfo from '@/components/UHGroupingsInfo';
import UHGroupingsInfo from '@/components/uh-groupings-info';

const About = () => (
<main>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/api/cas/login/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from 'next/navigation';
import type { NextRequest } from 'next/server';
import { handleLogin } from '@/access/AuthenticationService';
import { handleLogin } from '@/access/authentication';

const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string;

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/api/cas/logout/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from 'next/navigation';
import { handleLogout } from '@/access/AuthenticationService';
import { handleLogout } from '@/access/authentication';

const baseUrl = process.env.NEXT_PUBLIC_BASE_URL as string;

Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './globals.css';
import { Source_Sans_3 } from 'next/font/google';
import Footer from '@/components/layout/footer/Footer';
import Footer from '@/components/layout/footer/footer';
import type { Metadata } from 'next';
import Navbar from '@/components/layout/navbar/Navbar';
import Navbar from '@/components/layout/navbar/navbar';

const sourceSans3 = Source_Sans_3({
subsets: ['latin'],
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/layout/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Link from 'next/link';
import Image from 'next/image';
import LoginButton from './LoginButton';
import { getCurrentUser } from '@/access/AuthenticationService';
import MobileNavbar from './MobileNavbar';
import { NavLinks } from './NavLinks';
import Role from '@/access/Role';
import TimeoutModal from '@/components/modal/TimeoutModal';
import LoginButton from './login-button';
import { getCurrentUser } from '@/access/authentication';
import MobileNavbar from './mobile-navbar';
import { NavLinks } from './nav-links';
import Role from '@/access/role';
import TimeoutModal from '@/components/modal/timeout-modal';

const Navbar = async () => {
const currentUser = await getCurrentUser();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { Button } from '@/components/ui/button';
import Role from '@/access/Role';
import User from '@/access/User';
import { login, logout } from '@/access/AuthenticationService';
import Role from '@/access/role';
import User from '@/access/user';
import { login, logout } from '@/access/authentication';
import { LogInIcon, LogOutIcon } from 'lucide-react';

const LoginButton = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
SheetContent,
SheetTrigger,
} from '@/components/ui/sheet'
import User from '@/access/User';
import User from '@/access/user';
import Link from 'next/link';
import { NavLinks } from './NavLinks';
import { NavLinks } from './nav-links';
import { useState } from 'react';
import Role from '@/access/Role';
import Role from '@/access/role';

const MobileNavbar = ({
currentUser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Role from '@/access/Role';
import Role from '@/access/role';

export const NavLinks = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
AlertDialogCancel
} from '@/components/ui/alert-dialog';
import { useIdleTimer } from 'react-idle-timer';
import { logout } from '@/access/AuthenticationService';
import User from '@/access/User';
import Role from '@/access/Role';
import { logout } from '@/access/authentication';
import User from '@/access/user';
import Role from '@/access/role';

const timeout = 1000 * 60 * 30; // Total timeout - 30 minutes in milliseconds
const promptBeforeIdle = 1000 * 60 * 5; // Time prior to timeout until modal opens - 5 minutes in milliseconds
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ui/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cookies } from 'next/headers';
import { NextResponse, NextRequest } from 'next/server';
import { getIronSession } from 'iron-session';
import { SessionData, SessionOptions } from './access/Session';
import Role from './access/Role';
import { SessionData, SessionOptions } from '@/access/session';
import Role from '@/access/role';

/**
* Next.js middleware function that is called upon visiting a route that matches the config.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/tests/access/Role.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Role from '@/access/Role';
import Role from '@/access/role';

describe('Role', () => {

Expand Down
4 changes: 2 additions & 2 deletions ui/tests/access/User.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Role from '@/access/Role';
import { AnonymousUser } from '@/access/User';
import Role from '@/access/role';
import { AnonymousUser } from '@/access/user';

describe('User', () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCurrentUser, login, logout, handleLogin, handleLogout } from '@/access/AuthenticationService';
import { createMockSession } from '../setupJest';
import User, { AnonymousUser } from '@/access/User';
import { getCurrentUser, login, logout, handleLogin, handleLogout } from '@/access/authentication';
import { createMockSession } from '../setup-jest';
import User, { AnonymousUser } from '@/access/user';
import { redirect } from 'next/navigation';
import IronSession from 'iron-session';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { setRoles } from '@/access/AuthorizationService';
import Role from '@/access/Role';
import User, { AnonymousUser } from '@/access/User';
import { setRoles } from '@/access/authorization';
import Role from '@/access/role';
import User, { AnonymousUser } from '@/access/user';

const testUser: User = JSON.parse(process.env.TEST_USER_A as string);
const apiBaseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string;

describe('AuthorizationService', () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { validateTicket } from '@/access/Saml11Validator';
import User, { AnonymousUser } from '@/access/User';
import { validateTicket } from '@/access/saml-11-validator';
import User, { AnonymousUser } from '@/access/user';

const testUser: User = JSON.parse(process.env.TEST_USER_A as string);
const xmlSoapResponse = process.env.XML_SOAP_RESPONSE as string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import User from '@/access/User';
import { Feedback, sendFeedback, sendStackTrace } from '@/services/EmailService';
import * as AuthenticationService from '@/access/AuthenticationService';
import User from '@/access/user';
import { Feedback, sendFeedback, sendStackTrace } from '@/actions/email';
import * as AuthenticationService from '@/access/authentication';

const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL as string;
const testUser: User = JSON.parse(process.env.TEST_USER_A as string);

jest.mock('@/access/AuthenticationService');
jest.mock('@/access/authentication');

describe('EmailService', () => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ import {
resetIncludeGroup,
resetIncludeGroupAsync,
updateDescription
} from '@/services/GroupingsApiService';
import * as AuthenticationService from '@/access/AuthenticationService';
import User from '@/access/User';
} from '@/actions/groupings-api';
import * as AuthenticationService from '@/access/authentication';
import User from '@/access/user';

const baseUrl = process.env.NEXT_PUBLIC_API_2_1_BASE_URL as string;
const testUser: User = JSON.parse(process.env.TEST_USER_A as string);

jest.mock('@/access/AuthenticationService');
jest.mock('@/services/EmailService');
jest.mock('@/access/authentication');
jest.mock('@/actions/email');

describe('GroupingsService', () => {

Expand Down
6 changes: 3 additions & 3 deletions ui/tests/app/(index)/_components/Announcement.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render, screen } from '@testing-library/react';
import Announcements from '@/app/(index)/_components/Announcements';
import * as GroupingsApiService from '@/services/GroupingsApiService';
import Announcements from '@/app/(index)/_components/announcements';
import * as GroupingsApiService from '@/actions/groupings-api';

jest.mock('@/services/GroupingsApiService');
jest.mock('@/actions/groupings-api');

const message = 'test announcement';
const message1 = 'test1 announcement';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Role from '@/access/Role'
import Role from '@/access/role'
import { render, screen } from '@testing-library/react';
import User from '@/access/User';
import * as GroupingsApiService from '@/services/GroupingsApiService';
import * as AuthenticationService from '@/access/AuthenticationService';
import afterLogin from '@/app/(index)/_components/AfterLogin';
import User from '@/access/user';
import * as GroupingsApiService from '@/actions/groupings-api';
import * as AuthenticationService from '@/access/authentication';
import afterLogin from '@/app/(index)/_components/after-login';

jest.mock('@/actions/groupings-api');
jest.mock('@/access/authentication');

jest.mock('@/services/GroupingsApiService');
jest.mock('@/access/AuthenticationService');
const testUser: User = JSON.parse(process.env.TEST_USER_A as string);

describe('AfterLogin', () => {
Expand Down
Loading

0 comments on commit 2eb08d1

Please sign in to comment.