refactor: count all return type (#17529)

This commit is contained in:
Jason Rasmussen
2025-04-10 14:38:49 -04:00
committed by GitHub
parent abde0fbe60
commit 0b22d3348e
9 changed files with 52 additions and 55 deletions

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { ExpressionBuilder, Insertable, Kysely, Updateable } from 'kysely';
import { ExpressionBuilder, Insertable, Kysely, NotNull, Updateable } from 'kysely';
import { jsonObjectFrom } from 'kysely/helpers/postgres';
import { InjectKysely } from 'nestjs-kysely';
import { columns, Partner } from 'src/database';
import { columns } from 'src/database';
import { DB, Partners } from 'src/db';
import { DummyValue, GenerateSql } from 'src/decorators';
@@ -44,7 +44,7 @@ export class PartnerRepository {
return this.builder()
.where('sharedWithId', '=', sharedWithId)
.where('sharedById', '=', sharedById)
.executeTakeFirst() as Promise<Partner | undefined>;
.executeTakeFirst();
}
@GenerateSql({ params: [{ sharedWithId: DummyValue.UUID, sharedById: DummyValue.UUID }] })
@@ -55,7 +55,8 @@ export class PartnerRepository {
.returningAll()
.returning(withSharedBy)
.returning(withSharedWith)
.executeTakeFirstOrThrow() as Promise<Partner>;
.$narrowType<{ sharedWith: NotNull; sharedBy: NotNull }>()
.executeTakeFirstOrThrow();
}
@GenerateSql({ params: [{ sharedWithId: DummyValue.UUID, sharedById: DummyValue.UUID }, { inTimeline: true }] })
@@ -68,7 +69,8 @@ export class PartnerRepository {
.returningAll()
.returning(withSharedBy)
.returning(withSharedWith)
.executeTakeFirstOrThrow() as Promise<Partner>;
.$narrowType<{ sharedWith: NotNull; sharedBy: NotNull }>()
.executeTakeFirstOrThrow();
}
@GenerateSql({ params: [{ sharedWithId: DummyValue.UUID, sharedById: DummyValue.UUID }] })