Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/log-auth-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbs authored Nov 8, 2023
2 parents 5db7122 + 55042af commit 29fb9ea
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { Metadata } from "next"
import { UserProvider } from "@auth0/nextjs-auth0/client"
import { config as fontAwesomeConfig } from "@fortawesome/fontawesome-svg-core"
import { CssBaseline } from "@mui/material"
import ThemeRegistry from "@/common/theme/ThemeRegistry"
import ErrorHandler from "@/common/errors/client/ErrorHandler"
import ThemeRegistry from "../common/theme/ThemeRegistry"
import ErrorHandler from "../common/errors/client/ErrorHandler"
import "@fortawesome/fontawesome-svg-core/styles.css"

fontAwesomeConfig.autoAddCss = false
Expand Down
2 changes: 1 addition & 1 deletion src/common/errors/client/ErrorHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import { SWRConfig } from "swr"
import { FetcherError } from "@/common/utils/fetcher"
import { FetcherError } from "@/common"

export default function ErrorHandler({
children
Expand Down
2 changes: 1 addition & 1 deletion src/common/mutex/SessionMutexFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import IKeyedMutexFactory from "./IKeyedMutexFactory"
import IMutex from "./IMutex"
import IMutexFactory from "./IMutexFactory"
import ISession from "@/common/session/ISession"
import { ISession } from "@/common"

export default class SessionMutexFactory implements IMutexFactory {
private readonly mutexFactory: IKeyedMutexFactory
Expand Down
4 changes: 1 addition & 3 deletions src/features/auth/domain/oAuthToken/OAuthTokenRepository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import ZodJSONCoder from "../../../../common/utils/ZodJSONCoder"
import IUserDataRepository from "@/common/userData/IUserDataRepository"
import { UnauthorizedError } from "../../../../common/errors"
import { IUserDataRepository, UnauthorizedError, ZodJSONCoder } from "../../../../common"
import IOAuthTokenRepository from "./IOAuthTokenRepository"
import OAuthToken, { OAuthTokenSchema } from "./OAuthToken"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IGitHubClient from "@/common/github/IGitHubClient"
import { IGitHubClient } from "@/common"
import IPullRequestCommentRepository, {
GetPullRequestCommentsOperation,
AddPullRequestCommentOperation,
Expand Down
2 changes: 1 addition & 1 deletion src/features/projects/data/GitHubProjectDataSource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IGitHubClient from "@/common/github/IGitHubClient"
import { IGitHubClient } from "@/common"
import {
Project,
IProjectConfig,
Expand Down
18 changes: 11 additions & 7 deletions src/features/projects/domain/ProjectRepository.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { ZodJSONCoder, ISession, IUserDataRepository } from "../../../common"
import { IUserDataRepository, ZodJSONCoder } from "../../../common"
import IProjectRepository from "./IProjectRepository"
import Project, { ProjectSchema } from "./Project"

interface IUserIDReader {
getUserId(): Promise<string>
}

type Repository = IUserDataRepository<string>

export default class ProjectRepository implements IProjectRepository {
private readonly session: ISession
private readonly userIDReader: IUserIDReader
private readonly repository: Repository

constructor(session: ISession, repository: Repository) {
this.session = session
constructor(userIDReader: IUserIDReader, repository: Repository) {
this.userIDReader = userIDReader
this.repository = repository
}

async get(): Promise<Project[] | undefined> {
const userId = await this.session.getUserId()
const userId = await this.userIDReader.getUserId()
const string = await this.repository.get(userId)
if (!string) {
return undefined
Expand All @@ -23,13 +27,13 @@ export default class ProjectRepository implements IProjectRepository {
}

async set(projects: Project[]): Promise<void> {
const userId = await this.session.getUserId()
const userId = await this.userIDReader.getUserId()
const string = ZodJSONCoder.encode(ProjectSchema.array(), projects)
await this.repository.set(userId, string)
}

async delete(): Promise<void> {
const userId = await this.session.getUserId()
const userId = await this.userIDReader.getUserId()
await this.repository.delete(userId)
}
}

0 comments on commit 29fb9ea

Please sign in to comment.