refactor: 🏷️ Move all types that represent ORM abstractions to ORM class static properties

This commit is contained in:
Jesse Wierzbinski 2024-11-04 14:58:17 +01:00
parent ca31830fb3
commit 02c3c9d0bf
No known key found for this signature in database
17 changed files with 143 additions and 136 deletions

View file

@ -1,15 +1,9 @@
import { parseUserAddress, userAddressValidator } from "@/api";
import { Args, type Command, Flags, type Interfaces } from "@oclif/core";
import { Instance, User, db } from "@versia/kit/db";
import { type Emoji, Instance, User, db } from "@versia/kit/db";
import { Emojis, Instances, Users } from "@versia/kit/tables";
import chalk from "chalk";
import {
type InferSelectModel,
and,
eq,
getTableColumns,
like,
} from "drizzle-orm";
import { and, eq, getTableColumns, like } from "drizzle-orm";
import { BaseCommand } from "./base.ts";
export type FlagsType<T extends typeof Command> = Interfaces.InferredFlags<
@ -210,9 +204,12 @@ export abstract class EmojiFinderCommand<
}
public async findEmojis(): Promise<
(InferSelectModel<typeof Emojis> & {
instanceUrl: string | null;
})[]
Omit<
typeof Emoji.$type & {
instanceUrl: string | null;
},
"instance"
>[]
> {
// Check if there are asterisks in the identifier but no pattern flag, warn the user if so
if (this.args.identifier.includes("*") && !this.flags.pattern) {