refactor(database): 🔥 Always import SQL operators directly from drizzle
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 7s
Build Docker Images / tests (push) Failing after 7s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
Build Docker Images / check (push) Failing after 7s

This commit is contained in:
Jesse Wierzbinski 2025-05-26 19:00:24 +02:00
parent d3f411915f
commit 9eac364e01
No known key found for this signature in database
14 changed files with 23 additions and 25 deletions

View file

@ -76,7 +76,7 @@ export default apiRoute((app) => {
if (timeline.includes("home")) {
const found = await db.query.Markers.findFirst({
where: (marker, { and, eq }): SQL | undefined =>
where: (marker): SQL | undefined =>
and(
eq(marker.userId, user.id),
eq(marker.timeline, "home"),
@ -102,7 +102,7 @@ export default apiRoute((app) => {
if (timeline.includes("notifications")) {
const found = await db.query.Markers.findFirst({
where: (marker, { and, eq }): SQL | undefined =>
where: (marker): SQL | undefined =>
and(
eq(marker.userId, user.id),
eq(marker.timeline, "notifications"),

View file

@ -1,6 +1,6 @@
import { RolePermission, Status as StatusSchema } from "@versia/client/schemas";
import { db } from "@versia/kit/db";
import type { SQL } from "drizzle-orm";
import { and, eq, type SQL } from "drizzle-orm";
import { describeRoute } from "hono-openapi";
import { resolver } from "hono-openapi/zod";
import { apiRoute, auth, withNoteParam } from "@/api";
@ -51,7 +51,7 @@ export default apiRoute((app) =>
if (
await db.query.UserToPinnedNotes.findFirst({
where: (userPinnedNote, { and, eq }): SQL | undefined =>
where: (userPinnedNote): SQL | undefined =>
and(
eq(userPinnedNote.noteId, note.data.id),
eq(userPinnedNote.userId, user.id),

View file

@ -56,7 +56,7 @@ export default apiRoute((app) => {
const { id } = context.req.valid("param");
const userFilter = await db.query.Filters.findFirst({
where: (filter, { eq, and }): SQL | undefined =>
where: (filter): SQL | undefined =>
and(eq(filter.userId, user.id), eq(filter.id, id)),
with: {
keywords: true,
@ -224,7 +224,7 @@ export default apiRoute((app) => {
}
const updatedFilter = await db.query.Filters.findFirst({
where: (filter, { eq, and }): SQL | undefined =>
where: (filter): SQL | undefined =>
and(eq(filter.userId, user.id), eq(filter.id, id)),
with: {
keywords: true,

View file

@ -6,7 +6,7 @@ import {
import { db } from "@versia/kit/db";
import { FilterKeywords, Filters } from "@versia/kit/tables";
import { randomUUIDv7 } from "bun";
import type { SQL } from "drizzle-orm";
import { eq, type SQL } from "drizzle-orm";
import { describeRoute } from "hono-openapi";
import { resolver, validator } from "hono-openapi/zod";
import { z } from "zod";
@ -44,8 +44,7 @@ export default apiRoute((app) => {
const { user } = context.get("auth");
const userFilters = await db.query.Filters.findMany({
where: (filter, { eq }): SQL | undefined =>
eq(filter.userId, user.id),
where: (filter): SQL | undefined => eq(filter.userId, user.id),
with: {
keywords: true,
},

View file

@ -86,7 +86,7 @@
},
"packages/client": {
"name": "@versia/client",
"version": "0.2.0-alpha.1",
"version": "0.2.0-alpha.3",
"dependencies": {
"@badgateway/oauth2-client": "^3.0.0",
"iso-639-1": "^3.1.5",

View file

@ -261,7 +261,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
{
with: {
relationships: {
where: (relationship, { eq, and }): SQL | undefined =>
where: (relationship): SQL | undefined =>
and(
eq(relationship.subjectId, this.data.authorId),
eq(relationship.following, true),
@ -597,7 +597,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
if (this.data.visibility === "private") {
return user
? !!(await db.query.Relationships.findFirst({
where: (relationship, { and, eq }): SQL | undefined =>
where: (relationship): SQL | undefined =>
and(
eq(relationship.ownerId, user?.id),
eq(relationship.subjectId, Notes.authorId),

View file

@ -204,7 +204,7 @@ export class Relationship extends BaseInterface<
ownerId: string;
}): Promise<RelationshipType> {
let output = await db.query.Relationships.findFirst({
where: (rel, { and, eq }): SQL | undefined =>
where: (rel): SQL | undefined =>
and(
eq(rel.ownerId, oppositeTo.subjectId),
eq(rel.subjectId, oppositeTo.ownerId),

View file

@ -91,8 +91,7 @@ export class Role extends BaseInterface<typeof Roles> {
): Promise<Role[]> {
return (
await db.query.RoleToUsers.findMany({
where: (role, { eq }): SQL | undefined =>
eq(role.userId, userId),
where: (role): SQL | undefined => eq(role.userId, userId),
with: {
role: true,
user: {

View file

@ -464,7 +464,7 @@ export class User extends BaseInterface<typeof Users, UserWithRelations> {
> {
// Get all linked accounts
const accounts = await db.query.OpenIdAccounts.findMany({
where: (User, { eq }): SQL | undefined => eq(User.userId, this.id),
where: (User): SQL | undefined => eq(User.userId, this.id),
});
return accounts

View file

@ -156,7 +156,7 @@ export default (plugin: PluginType): void => {
// Check if account is already linked
const account = await db.query.OpenIdAccounts.findFirst({
where: (account, { eq, and }): SQL | undefined =>
where: (account): SQL | undefined =>
and(
eq(account.serverId, sub),
eq(account.issuerId, issuer.id),
@ -195,7 +195,7 @@ export default (plugin: PluginType): void => {
let userId = (
await db.query.OpenIdAccounts.findFirst({
where: (account, { eq, and }): SQL | undefined =>
where: (account): SQL | undefined =>
and(
eq(account.serverId, sub),
eq(account.issuerId, issuer.id),

View file

@ -1,6 +1,6 @@
import { RolePermission } from "@versia/client/schemas";
import { db } from "@versia/kit/db";
import { eq, type SQL } from "@versia/kit/drizzle";
import { and, eq, type SQL } from "@versia/kit/drizzle";
import { OpenIdAccounts } from "@versia/kit/tables";
import { describeRoute } from "hono-openapi";
import { resolver, validator } from "hono-openapi/zod";
@ -58,7 +58,7 @@ export default (plugin: PluginType): void => {
}
const account = await db.query.OpenIdAccounts.findFirst({
where: (account, { eq, and }): SQL | undefined =>
where: (account): SQL | undefined =>
and(
eq(account.userId, user.id),
eq(account.issuerId, issuerId),
@ -127,7 +127,7 @@ export default (plugin: PluginType): void => {
}
const account = await db.query.OpenIdAccounts.findFirst({
where: (account, { eq, and }): SQL | undefined =>
where: (account): SQL | undefined =>
and(
eq(account.userId, user.id),
eq(account.issuerId, issuerId),

View file

@ -1,5 +1,5 @@
import { type Application, db } from "@versia/kit/db";
import type { InferSelectModel, SQL } from "@versia/kit/drizzle";
import { eq, type InferSelectModel, type SQL } from "@versia/kit/drizzle";
import type { OpenIdLoginFlows } from "@versia/kit/tables";
import {
type AuthorizationResponseError,
@ -39,7 +39,7 @@ const getFlow = (
| undefined
> => {
return db.query.OpenIdLoginFlows.findFirst({
where: (flow, { eq }): SQL | undefined => eq(flow.id, flowId),
where: (flow): SQL | undefined => eq(flow.id, flowId),
with: {
application: true,
},

View file

@ -26,7 +26,7 @@
//"isolatedDeclarations": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"target": "esnext",
"target": "ESNext",
"jsx": "preserve",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"composite": true,

View file

@ -170,7 +170,7 @@ export const checkRouteNeedsChallenge = async (
}
const challenge = await db.query.Challenges.findFirst({
where: (c, { eq }): SQL | undefined => eq(c.id, challenge_id),
where: (c): SQL | undefined => eq(c.id, challenge_id),
});
if (!challenge) {