Fixed "any" types for Knex transaction objects
no issue - We should use specific types wherever possible instead of "any" as it's an antipattern that spreads like cancer through the codebase.
This commit is contained in:
parent
18a4fa8cd9
commit
a44d4a24d3
@ -1,10 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import {Collection} from './Collection';
|
||||
import {Knex} from "knex";
|
||||
|
||||
export interface CollectionRepository {
|
||||
createTransaction(fn: (transaction: any) => Promise<any>): Promise<any>
|
||||
save(collection: Collection, options?: {transaction: any}): Promise<void>
|
||||
getById(id: string, options?: {transaction: any}): Promise<Collection | null>
|
||||
getBySlug(slug: string, options?: {transaction: any}): Promise<Collection | null>
|
||||
createTransaction(fn: (transaction: Knex.Transaction) => Promise<any>): Promise<any>
|
||||
save(collection: Collection, options?: {transaction: Knex.Transaction}): Promise<void>
|
||||
getById(id: string, options?: {transaction: Knex.Transaction}): Promise<Collection | null>
|
||||
getBySlug(slug: string, options?: {transaction: Knex.Transaction}): Promise<Collection | null>
|
||||
getAll(options?: any): Promise<Collection[]>
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ const messages = {
|
||||
};
|
||||
|
||||
interface SlugService {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
generate(desired: string, options: {transaction: any}): Promise<string>;
|
||||
generate(desired: string, options: {transaction: Knex.Transaction}): Promise<string>;
|
||||
}
|
||||
|
||||
type CollectionsServiceDeps = {
|
||||
@ -95,12 +94,12 @@ type QueryOptions = {
|
||||
include?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
transaction?: any;
|
||||
transaction?: Knex.Transaction;
|
||||
}
|
||||
|
||||
interface PostsRepository {
|
||||
getAll(options: QueryOptions): Promise<CollectionPost[]>;
|
||||
getBulk(ids: string[], transaction?: Knex.Transaction): Promise<CollectionPost[]>;
|
||||
}
|
||||
|
||||
export class CollectionsService {
|
||||
|
Loading…
Reference in New Issue
Block a user