fix: mysql operations not working (#1728)

This commit is contained in:
Meier Lukas
2024-12-19 16:10:22 +01:00
committed by GitHub
parent 2ae3d938ee
commit 550bca6dee
81 changed files with 136 additions and 110 deletions

View File

@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import { createId } from "@homarr/db";
import { apps } from "@homarr/db/schema/sqlite";
import { apps } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import type { GroupPermissionKey } from "@homarr/definitions";

View File

@@ -17,7 +17,7 @@ import {
sections,
serverSettings,
users,
} from "@homarr/db/schema/sqlite";
} from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import type { BoardPermission, GroupPermissionKey } from "@homarr/definitions";

View File

@@ -2,7 +2,7 @@ import { describe, expect, test, vi } from "vitest";
import * as authShared from "@homarr/auth/shared";
import { createId, eq } from "@homarr/db";
import { boards, users } from "@homarr/db/schema/sqlite";
import { boards, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import { throwIfActionForbiddenAsync } from "../../board/board-access";

View File

@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import * as env from "@homarr/auth/env.mjs";
import { createId, eq } from "@homarr/db";
import { groupMembers, groupPermissions, groups, users } from "@homarr/db/schema/sqlite";
import { groupMembers, groupPermissions, groups, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import type { GroupPermissionKey } from "@homarr/definitions";

View File

@@ -2,7 +2,7 @@ import { describe, expect, test, vi } from "vitest";
import * as authShared from "@homarr/auth/shared";
import { createId, eq } from "@homarr/db";
import { integrations, users } from "@homarr/db/schema/sqlite";
import { integrations, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import { throwIfActionForbiddenAsync } from "../../integration/integration-access";

View File

@@ -4,7 +4,7 @@ import { describe, expect, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import { encryptSecret } from "@homarr/common/server";
import { createId } from "@homarr/db";
import { integrations, integrationSecrets } from "@homarr/db/schema/sqlite";
import { integrations, integrationSecrets } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import type { GroupPermissionKey } from "@homarr/definitions";

View File

@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import { createId } from "@homarr/db";
import { invites, users } from "@homarr/db/schema/sqlite";
import { invites, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import { inviteRouter } from "../invite";

View File

@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import { createId } from "@homarr/db";
import { serverSettings } from "@homarr/db/schema/sqlite";
import { serverSettings } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import { defaultServerSettings, defaultServerSettingsKeys } from "@homarr/server-settings";

View File

@@ -2,8 +2,8 @@ import { describe, expect, it, test, vi } from "vitest";
import type { Session } from "@homarr/auth";
import type { Database } from "@homarr/db";
import { createId, eq, schema } from "@homarr/db";
import { onboarding, users } from "@homarr/db/schema/sqlite";
import { createId, eq } from "@homarr/db";
import { invites, onboarding, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test";
import type { GroupPermissionKey, OnboardingStep } from "@homarr/definitions";
@@ -121,7 +121,7 @@ describe("register should create a user with valid invitation", () => {
await db.insert(users).values({
id: userId,
});
await db.insert(schema.invites).values({
await db.insert(invites).values({
id: inviteId,
token: inviteToken,
creatorId: userId,
@@ -176,7 +176,7 @@ describe("register should create a user with valid invitation", () => {
await db.insert(users).values({
id: userId,
});
await db.insert(schema.invites).values({
await db.insert(invites).values({
id: inviteId,
token: inviteToken,
creatorId: userId,
@@ -211,7 +211,7 @@ describe("editProfile shoud update user", () => {
const emailVerified = new Date(2024, 0, 5);
await db.insert(schema.users).values({
await db.insert(users).values({
id: defaultOwnerId,
name: "TEST 1",
email: "abc@gmail.com",
@@ -226,7 +226,7 @@ describe("editProfile shoud update user", () => {
});
// assert
const user = await db.select().from(schema.users).where(eq(schema.users.id, defaultOwnerId));
const user = await db.select().from(users).where(eq(users.id, defaultOwnerId));
expect(user).toHaveLength(1);
expect(user[0]).containSubset({
@@ -245,7 +245,7 @@ describe("editProfile shoud update user", () => {
session: defaultSession,
});
await db.insert(schema.users).values({
await db.insert(users).values({
id: defaultOwnerId,
name: "TEST 1",
email: "abc@gmail.com",
@@ -260,7 +260,7 @@ describe("editProfile shoud update user", () => {
});
// assert
const user = await db.select().from(schema.users).where(eq(schema.users.id, defaultOwnerId));
const user = await db.select().from(users).where(eq(users.id, defaultOwnerId));
expect(user).toHaveLength(1);
expect(user[0]).containSubset({
@@ -295,11 +295,11 @@ describe("delete should delete user", () => {
},
];
await db.insert(schema.users).values(initialUsers);
await db.insert(users).values(initialUsers);
await caller.delete({ userId: defaultOwnerId });
const usersInDb = await db.select().from(schema.users);
const usersInDb = await db.select().from(users);
expect(usersInDb).toHaveLength(2);
expect(usersInDb[0]).containSubset(initialUsers[0]);
expect(usersInDb[1]).containSubset(initialUsers[2]);