Skip to content

Commit

Permalink
chore: remove shared-auth in favor of shared-models
Browse files Browse the repository at this point in the history
  • Loading branch information
timonmasberg committed Feb 10, 2024
1 parent 2e9347e commit a20a6a4
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion apps/api/dev-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ application of our AAD.
| testuser | c0cc4404-7907-4480-86d3-ba4bfc513c6d | Test | User | [email protected] | testorganization (dff7584efe2c174eee8bae45) | `eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJvaWQiOiIxMjM0IiwiZW1haWxzIjpbInRlc3R1c2VyQHRlc3QuY29tIl0sImdpdmVuX25hbWUiOiJUZXN0IiwiZmFtaWx5X25hbWUiOiJVc2VyIDEifQ.` |

The claims will be mapped to the
[AuthUser](../../libs/shared/auth/src/lib/auth-user.model.ts) Model in the
[AuthUser](../../libs/shared/model/src/lib/auth-user.model.ts) Model in the
[AuthInterceptor](../../libs/api/auth/src/lib/interceptors/auth.interceptor.ts).
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Request } from 'express';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

export abstract class AuthUserExtractorStrategy {
abstract getUserFromRequest(req: Request): AuthUser | null;
Expand Down
2 changes: 1 addition & 1 deletion libs/api/auth/src/lib/decorators/user.decorator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createGqlContextForRequest,
createParamDecoratorFactory,
} from '@kordis/api/test-helpers';
import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { User } from './user.decorator';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createGqlContextForRequest,
createHttpContextForRequest,
} from '@kordis/api/test-helpers';
import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { AuthUserExtractorStrategy } from '../auth-user-extractor-strategies/auth-user-extractor.strategy';
import { AuthInterceptor } from './auth.interceptor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Observable, firstValueFrom, of } from 'rxjs';

import { KordisRequest } from '@kordis/api/shared';
import { createGqlContextForRequest } from '@kordis/api/test-helpers';
import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { SentryOTelUserContextInterceptor } from './sentry-otel-user-context.interceptor';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as Sentry from '@sentry/node';
import { Observable } from 'rxjs';

import { KordisGqlContext, KordisRequest } from '@kordis/api/shared';
import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

@Injectable()
export class SentryOTelUserContextInterceptor implements NestInterceptor {
Expand Down
2 changes: 1 addition & 1 deletion libs/api/shared/src/lib/models/request.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Request } from 'express';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

export interface KordisGqlContext {
req: KordisRequest;
Expand Down
1 change: 0 additions & 1 deletion libs/shared/auth/src/index.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shared-auth",
"name": "shared-model",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared/auth/src",
"sourceRoot": "libs/shared/model/src",
"projectType": "library",
"targets": {
"lint": {
Expand Down
2 changes: 2 additions & 0 deletions libs/shared/model/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/shared-model';
export { default as AuthUser } from '../../model/src/lib/auth-user.model';
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts", "../../../reset.d.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion libs/spa/auth/src/lib/components/dev-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { Router } from '@angular/router';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { AUTH_SERVICE } from '../services/auth-service';
import { DevAuthService } from '../services/dev-auth.service';
Expand Down
4 changes: 3 additions & 1 deletion libs/spa/auth/src/lib/services/auth-service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { InjectionToken } from '@angular/core';
import { Observable } from 'rxjs';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

export interface AuthService {
readonly user$: Observable<AuthUser | null>;
readonly isAuthenticated$: Observable<boolean>;

login(): void;

logout(): void;
}

Expand Down
2 changes: 1 addition & 1 deletion libs/spa/auth/src/lib/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
shareReplay,
} from 'rxjs';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { AuthService } from './auth-service';

Expand Down
2 changes: 1 addition & 1 deletion libs/spa/auth/src/lib/services/dev-auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { BehaviorSubject, Observable, map } from 'rxjs';

import { AuthUser } from '@kordis/shared/auth';
import { AuthUser } from '@kordis/shared/model';

import { AuthService } from './auth-service';

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@kordis/api/organization": ["libs/api/organization/src/index.ts"],
"@kordis/api/shared": ["libs/api/shared/src/index.ts"],
"@kordis/api/test-helpers": ["libs/api/test-helpers/src/index.ts"],
"@kordis/shared/auth": ["libs/shared/auth/src/index.ts"],
"@kordis/shared/model": ["libs/shared/model/src/index.ts"],
"@kordis/spa/auth": ["libs/spa/auth/src/index.ts"],
"@kordis/spa/observability": ["libs/spa/observability/src/index.ts"]
}
Expand Down

0 comments on commit a20a6a4

Please sign in to comment.