code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped

This commit is contained in:
2026-01-26 12:52:24 +01:00
parent f877f821ef
commit cfc30c79a8
62 changed files with 227 additions and 173 deletions

View File

@@ -1,7 +1,8 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { InMemoryMagicLinkRepository } from './InMemoryMagicLinkRepository';
import type { Logger } from '@core/shared/domain/Logger';
const mockLogger = {
const mockLogger: Logger = {
debug: () => {},
info: () => {},
warn: () => {},
@@ -12,7 +13,7 @@ describe('InMemoryMagicLinkRepository', () => {
let repository: InMemoryMagicLinkRepository;
beforeEach(() => {
repository = new InMemoryMagicLinkRepository(mockLogger as any);
repository = new InMemoryMagicLinkRepository(mockLogger);
});
describe('createPasswordResetRequest', () => {

View File

@@ -1,4 +1,4 @@
import { RatingEvent } from '@core/identity/domain/entities/RatingEvent';
import { RatingEvent, RatingEventProps } from '@core/identity/domain/entities/RatingEvent';
import { RatingDelta } from '@core/identity/domain/value-objects/RatingDelta';
import { RatingDimensionKey } from '@core/identity/domain/value-objects/RatingDimensionKey';
import { RatingEventId } from '@core/identity/domain/value-objects/RatingEventId';
@@ -14,7 +14,7 @@ export class RatingEventOrmMapper {
* Convert ORM entity to domain entity
*/
static toDomain(entity: RatingEventOrmEntity): RatingEvent {
const props: any = {
const props: RatingEventProps = {
id: RatingEventId.create(entity.id),
userId: entity.userId,
dimension: RatingDimensionKey.create(entity.dimension),

View File

@@ -1,4 +1,4 @@
import { UserRating } from '@core/identity/domain/value-objects/UserRating';
import { UserRating, UserRatingProps } from '@core/identity/domain/value-objects/UserRating';
import { UserRatingOrmEntity } from '../entities/UserRatingOrmEntity';
/**
@@ -11,7 +11,7 @@ export class UserRatingOrmMapper {
* Convert ORM entity to domain value object
*/
static toDomain(entity: UserRatingOrmEntity): UserRating {
const props: any = {
const props: UserRatingProps = {
userId: entity.userId,
driver: entity.driver,
admin: entity.admin,

View File

@@ -1,5 +1,6 @@
import type { DataSource } from 'typeorm';
import { describe, expect, it, vi } from 'vitest';
import type { RatingEvent } from '@core/identity/domain/entities/RatingEvent';
import { TypeOrmRatingEventRepository } from './TypeOrmRatingEventRepository';
@@ -30,7 +31,7 @@ describe('TypeOrmRatingEventRepository', () => {
reason: { code: 'TEST', summary: 'Test', details: {} },
visibility: { public: true, redactedFields: [] },
version: 1,
} as any;
} as unknown as RatingEvent;
// Mock the mapper
vi.doMock('../mappers/RatingEventOrmMapper', () => ({

View File

@@ -1,5 +1,6 @@
import type { DataSource } from 'typeorm';
import { describe, expect, it, vi } from 'vitest';
import type { UserRating } from '@core/identity/domain/value-objects/UserRating';
import { TypeOrmUserRatingRepository } from './TypeOrmUserRatingRepository';
@@ -41,7 +42,7 @@ describe('TypeOrmUserRatingRepository', () => {
overallReputation: 50,
createdAt: new Date(),
updatedAt: new Date(),
} as any;
} as unknown as UserRating;
const result = await repo.save(mockRating);
expect(result).toBe(mockRating);

View File

@@ -47,9 +47,10 @@ function buildSetCookieHeader(options: {
return parts.join('; ');
}
function appendSetCookieHeader(existing: string | string[] | undefined, next: string): string[] {
function appendSetCookieHeader(existing: string | number | string[] | undefined, next: string): string[] {
if (!existing) return [next];
if (Array.isArray(existing)) return [...existing, next];
if (typeof existing === 'number') return [existing.toString(), next];
return [existing, next];
}
@@ -111,7 +112,7 @@ export class CookieIdentitySessionAdapter implements IdentitySessionPort {
});
const existing = ctx.res.getHeader('Set-Cookie');
ctx.res.setHeader('Set-Cookie', appendSetCookieHeader(existing as any, setCookie));
ctx.res.setHeader('Set-Cookie', appendSetCookieHeader(existing, setCookie));
}
return session;
@@ -137,7 +138,7 @@ export class CookieIdentitySessionAdapter implements IdentitySessionPort {
});
const existing = ctx.res.getHeader('Set-Cookie');
ctx.res.setHeader('Set-Cookie', appendSetCookieHeader(existing as any, setCookie));
ctx.res.setHeader('Set-Cookie', appendSetCookieHeader(existing, setCookie));
return;
}