Update dependencies, fix (auto)import problems
This commit is contained in:
parent
267a83d484
commit
1d893c4a78
40 changed files with 5166 additions and 3047 deletions
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { order as orderType } from '~/utils/types/database';
|
import { type order as orderType } from '~/utils/types/database';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
order?: orderType
|
order?: orderType
|
||||||
|
|
8031
package-lock.json
generated
8031
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -13,10 +13,10 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mdi/font": "^7.2.96",
|
"@mdi/font": "^7.2.96",
|
||||||
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
||||||
"@typescript-eslint/parser": "^5.59.0",
|
"@typescript-eslint/parser": "^6.9.1",
|
||||||
"eslint": "^8.39.0",
|
"eslint": "^8.39.0",
|
||||||
"nuxt": "3.4.0",
|
"nuxt": "3.8.0",
|
||||||
"sass": "^1.62.0",
|
"sass": "^1.62.0",
|
||||||
"vite-plugin-vuetify": "^1.0.2",
|
"vite-plugin-vuetify": "^1.0.2",
|
||||||
"vuetify": "^3.1.15"
|
"vuetify": "^3.1.15"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
/* global $fetch */
|
/* global $fetch */
|
||||||
import { useRoute, useFetch, createError } from "nuxt/app";
|
import { useRoute, useFetch, createError } from "nuxt/app";
|
||||||
import { ref, Ref } from "vue";
|
import { ref, type Ref } from "vue";
|
||||||
|
|
||||||
import { VBtn, VForm } from "vuetify/components";
|
import { VBtn, VForm } from "vuetify/components";
|
||||||
import PagedList from "~/components/pagedList.vue";
|
import PagedList from "~/components/pagedList.vue";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
import { client as clientType, order, orderSummary } from "~/utils/types/database";
|
import { client as clientType, order, orderSummary } from "~/utils/types/database";
|
||||||
import OrderView from "~/components/orderView.vue";
|
import OrderView from "~/components/orderView.vue";
|
||||||
import EntryEditor, { fieldDefinition } from "~/components/entryEditor.vue";
|
import EntryEditor, { type fieldDefinition } from "~/components/entryEditor.vue";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const id = route.params.id;
|
const id = route.params.id;
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
/* global $fetch */
|
/* global $fetch */
|
||||||
import { useFetch, createError, navigateTo, NuxtError, useRoute } from "nuxt/app";
|
import { type NuxtError } from "nuxt/app";
|
||||||
import { ref, Ref, reactive } from "vue";
|
import { ref, type Ref, reactive } from "vue";
|
||||||
import { VBtn } from "vuetify/components";
|
import { VBtn } from "vuetify/components";
|
||||||
import { definePageMeta } from "~/.nuxt/imports";
|
|
||||||
|
|
||||||
import { client as clientType } from "~/utils/types/database";
|
import { type client as clientType } from "~/utils/types/database";
|
||||||
import pagedTable from "~/components/pagedTable.vue";
|
import pagedTable from "~/components/pagedTable.vue";
|
||||||
import Alerts, { AlertData } from "~/components/alerts.vue";
|
import Alerts, { type AlertData } from "~/components/alerts.vue";
|
||||||
import { fieldDefinition } from "~/components/entryEditor.vue";
|
import { type fieldDefinition } from "~/components/entryEditor.vue";
|
||||||
|
|
||||||
|
import { useFetch, createError, navigateTo, useRoute, definePageMeta } from "#imports";
|
||||||
|
|
||||||
definePageMeta({ middleware: ["auth"] });
|
definePageMeta({ middleware: ["auth"] });
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
/* global $fetch */
|
/* global $fetch */
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { NuxtError, navigateTo, useFetch } from 'nuxt/app';
|
import { type NuxtError } from 'nuxt/app';
|
||||||
import { definePageMeta } from '~/.nuxt/imports';
|
import { navigateTo, useFetch, definePageMeta } from '#imports';
|
||||||
|
|
||||||
import EntryEditor, { fieldDefinition } from '~/components/entryEditor.vue';
|
import EntryEditor, { type fieldDefinition } from '~/components/entryEditor.vue';
|
||||||
import Alerts, { AlertData } from '~/components/alerts.vue';
|
import Alerts, { type AlertData } from '~/components/alerts.vue';
|
||||||
|
|
||||||
const editorFields: Array<fieldDefinition> = [
|
const editorFields: Array<fieldDefinition> = [
|
||||||
{ key: "username", type: "text", label: "Username", optional: false },
|
{ key: "username", type: "text", label: "Username", optional: false },
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { navigateTo } from 'nuxt/app';
|
import { navigateTo } from '#imports';
|
||||||
|
|
||||||
navigateTo("/clients");
|
navigateTo("/clients");
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
/* global $fetch */
|
/* global $fetch */
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { VForm } from "vuetify/components";
|
import { VForm } from "vuetify/components";
|
||||||
import { navigateTo, useCookie, useFetch, useRoute } from "nuxt/app";
|
|
||||||
import { cookieSettings } from "~/utils/cookieSettings";
|
import { cookieSettings } from "~/utils/cookieSettings";
|
||||||
import { definePageMeta } from "~/.nuxt/imports";
|
import { definePageMeta, navigateTo, useCookie, useFetch, useRoute } from "#imports";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/* global defineEventHandler getQuery, createError */
|
import { defineEventHandler, getQuery } from "h3";
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
import BaaPagination from "~/server/utils/baaPagination";
|
import BaaPagination from "~/server/utils/baaPagination";
|
||||||
import { client } from "~/utils/types/database";
|
import { type client } from "~/utils/types/database";
|
||||||
|
|
||||||
export const baaWrapper = new BaaPagination<client, "id">("clients", "id");
|
export const baaWrapper = new BaaPagination<client, "id">("clients", "id");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/* global defineEventHandler, createError, readBody */
|
import { defineEventHandler, readBody } from "h3";
|
||||||
|
|
||||||
import { baaWrapper } from "./clients.get";
|
import { baaWrapper } from "./clients.get";
|
||||||
import { client } from "~/utils/types/database";
|
import { type client } from "~/utils/types/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
const clientKeys: Array<string> = [
|
const clientKeys: Array<string> = [
|
||||||
"name",
|
"name",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { baaWrapper } from "../clients.get";
|
import { baaWrapper } from "../clients.get";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { baaWrapper } from "../clients.get";
|
import { baaWrapper } from "../clients.get";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { checkIsClient } from "../clients.post";
|
import { checkIsClient } from "../clients.post";
|
||||||
import { baaWrapper } from "../clients.get";
|
import { baaWrapper } from "../clients.get";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { baaWrapper } from "~/server/api/orders.get";
|
import { baaWrapper } from "~/server/api/orders.get";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { baaWrapper } from "../clients.get";
|
import { baaWrapper } from "../clients.get";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { database } from "~/server/utils/database";
|
import { database } from "~/server/utils/database";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
export default defineEventHandler((event) => {
|
export default defineEventHandler((event) => {
|
||||||
const message = event.node.req.read();
|
const message = event.node.req.read();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
import { data, database } from "../utils/database";
|
import { type data, database } from "../utils/database";
|
||||||
|
|
||||||
export async function isFirstRun() {
|
export async function isFirstRun() {
|
||||||
const [tables] = await database.query({ sql: "SHOW TABLES", rowsAsArray: true }, []) as data<[string]>;
|
const [tables] = await database.query({ sql: "SHOW TABLES", rowsAsArray: true }, []) as data<[string]>;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
/* global defineEventHandler, setResponseStatus, readBody, createError */
|
|
||||||
|
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
|
import { defineEventHandler, setResponseStatus, readBody } from "h3";
|
||||||
|
|
||||||
import { database as db } from "../utils/database";
|
import { database as db } from "../utils/database";
|
||||||
import { isFirstRun } from "./firstRun.get";
|
import { isFirstRun } from "./firstRun.get";
|
||||||
import { getPasswordHash } from "./login.post";
|
import { getPasswordHash } from "./login.post";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
if (!isFirstRun()) {
|
if (!isFirstRun()) {
|
||||||
setResponseStatus(e, 404);
|
setResponseStatus(e, 404);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
export default defineEventHandler(() => {
|
export default defineEventHandler(() => {
|
||||||
return "Hi mom!";
|
return "Hi mom!";
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/* global defineEventHandler, getCookie, setCookie, readBody, createError */
|
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
import { defineEventHandler, getCookie, setCookie, readBody } from "h3";
|
||||||
|
|
||||||
import { database, data } from "../utils/database";
|
import { database, type data } from "../utils/database";
|
||||||
import { isString } from "../utils/isString";
|
import { isString } from "../utils/isString";
|
||||||
import { cookieSettings } from "../utils/rootUtils";
|
import { cookieSettings } from "../utils/rootUtils";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export function getPasswordHash(password: string) {
|
export function getPasswordHash(password: string) {
|
||||||
return crypto.createHmac("sha512", "42")
|
return crypto.createHmac("sha512", "42")
|
||||||
.update(password)
|
.update(password)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
/* global defineEventHandler, createError, getCookie, deleteCookie */
|
import { defineEventHandler, getCookie, deleteCookie } from "h3";
|
||||||
|
|
||||||
import { isAuthorised } from "../middleware/auth";
|
import { isAuthorised } from "../middleware/auth";
|
||||||
import { database } from "../utils/database";
|
import { database } from "../utils/database";
|
||||||
import { cookieSettings } from "../utils/rootUtils";
|
import { cookieSettings } from "../utils/rootUtils";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const token = getCookie(e, "token");
|
const token = getCookie(e, "token");
|
||||||
if (token === undefined) {
|
if (token === undefined) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* global defineEventHandler */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import BaaPagination from "../utils/baaPagination";
|
import BaaPagination from "../utils/baaPagination";
|
||||||
import { data, database } from "../utils/database";
|
import { type data, database } from "../utils/database";
|
||||||
import { client, orderSummary } from "~/utils/types/database";
|
import { type client, type orderSummary } from "~/utils/types/database";
|
||||||
|
|
||||||
export const baaWrapper = new BaaPagination<orderSummary, "id">(
|
export const baaWrapper = new BaaPagination<orderSummary, "id">(
|
||||||
"orderSummaries",
|
"orderSummaries",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global defineEventHandler, createError, readBody, setResponseStatus */
|
import { defineEventHandler, readBody, setResponseStatus } from "h3";
|
||||||
|
|
||||||
import { createValidationError, handleRecursedValidationError } from "../utils/validation";
|
import { createValidationError, handleRecursedValidationError } from "../utils/validation";
|
||||||
import { database as db } from "../utils/database";
|
import { database as db } from "../utils/database";
|
||||||
|
@ -6,6 +6,8 @@ import getRequestingUser from "../utils/getRequestingUser";
|
||||||
import { getOrder } from "./orders/[id].get";
|
import { getOrder } from "./orders/[id].get";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
type importedProduct = {
|
type importedProduct = {
|
||||||
name: string | null,
|
name: string | null,
|
||||||
link: string,
|
link: string,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
import { ResultSetHeader } from "mysql2";
|
import { type ResultSetHeader } from "mysql2";
|
||||||
|
|
||||||
import { database } from "~/server/utils/database";
|
import { database } from "~/server/utils/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const id = e.context.params?.id;
|
const id = e.context.params?.id;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
import { offer as offerType, order } from "~/utils/types/database";
|
import { type offer as offerType, type order } from "~/utils/types/database";
|
||||||
import { database, data } from "~/server/utils/database";
|
import { database, type data } from "~/server/utils/database";
|
||||||
|
|
||||||
export async function orderExists(id: string) {
|
export async function orderExists(id: string) {
|
||||||
const [[exists]] = await database.query(
|
const [[exists]] = await database.query(
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
/* global defineEventHandler, readBody, createError */
|
import { defineEventHandler, readBody } from "h3";
|
||||||
|
|
||||||
import { checkIsOrder } from "../orders.post";
|
import { checkIsOrder } from "../orders.post";
|
||||||
import { database as db } from "~/server/utils/database";
|
import { database as db } from "~/server/utils/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const body = await readBody(e);
|
const body = await readBody(e);
|
||||||
const id = e.context.params?.id;
|
const id = e.context.params?.id;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { orderExists, getImportedProducts } from "../[id].get";
|
import { orderExists, getImportedProducts } from "../[id].get";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const id = e.context.params?.id as string;
|
const id = e.context.params?.id as string;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
/* global defineEventHandler, readBody, createError, setResponseStatus */
|
import { defineEventHandler, readBody, setResponseStatus } from "h3";
|
||||||
|
|
||||||
import { checkIsImportedProduct } from "../../orders.post";
|
import { checkIsImportedProduct } from "../../orders.post";
|
||||||
import { getImportedProducts, orderExists } from "../[id].get";
|
import { getImportedProducts, orderExists } from "../[id].get";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
import { database } from "~/server/utils/database";
|
import { database } from "~/server/utils/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const body = await readBody(e);
|
const body = await readBody(e);
|
||||||
const idOrder = e.context.params?.id as string;
|
const idOrder = e.context.params?.id as string;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { orderExists, getWork } from "../[id].get";
|
import { orderExists, getWork } from "../[id].get";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const id = e.context.params?.id as string;
|
const id = e.context.params?.id as string;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
/* global defineEventHandler, readBody, createError, setResponseStatus */
|
import { defineEventHandler, readBody, setResponseStatus } from "h3";
|
||||||
|
|
||||||
import { checkIsWork } from "../../orders.post";
|
import { checkIsWork } from "../../orders.post";
|
||||||
import { getWork, orderExists } from "../[id].get";
|
import { getWork, orderExists } from "../[id].get";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
import { database } from "~/server/utils/database";
|
import { database } from "~/server/utils/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const body = await readBody(e);
|
const body = await readBody(e);
|
||||||
const idOrder = e.context.params?.id as string;
|
const idOrder = e.context.params?.id as string;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { ResultSetHeader } from "mysql2";
|
import { type ResultSetHeader } from "mysql2";
|
||||||
import { orderExists } from "../../[id].get";
|
import { orderExists } from "../../[id].get";
|
||||||
import { database } from "~/server/utils/database";
|
import { database } from "~/server/utils/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const idOrder = e.context.params?.id as string;
|
const idOrder = e.context.params?.id as string;
|
||||||
const idWork = e.context.params?.idWork as string;
|
const idWork = e.context.params?.idWork as string;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/* global defineEventHandler, createError */
|
import { defineEventHandler } from "h3";
|
||||||
|
|
||||||
import { orderExists, getWork } from "../../[id].get";
|
import { orderExists, getWork } from "../../[id].get";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default defineEventHandler((e) => {
|
export default defineEventHandler((e) => {
|
||||||
const idOrder = e.context.params?.id as string;
|
const idOrder = e.context.params?.id as string;
|
||||||
const idWork = e.context.params?.idWork as string;
|
const idWork = e.context.params?.idWork as string;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/* global defineEventHandler, getCookie */
|
/* global defineEventHandler, getCookie */
|
||||||
|
import { defineEventHandler, getCookie } from "h3";
|
||||||
|
|
||||||
import { database, data } from "~/server/utils/database";
|
import { database, type data } from "~/server/utils/database";
|
||||||
import { user } from "~/utils/types/database";
|
import { type user } from "~/utils/types/database";
|
||||||
|
|
||||||
export default defineEventHandler(async (e) => {
|
export default defineEventHandler(async (e) => {
|
||||||
const token = getCookie(e, "token");
|
const token = getCookie(e, "token");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* global defineEventHandler, createError, getCookie */
|
import { defineEventHandler, getCookie } from "h3";
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
import { database, data } from "~/server/utils/database";
|
import { database, type data } from "~/server/utils/database";
|
||||||
|
|
||||||
const endpointsWithoutAuth: string[] = [
|
const endpointsWithoutAuth: string[] = [
|
||||||
"/dbtest",
|
"/dbtest",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* global defineEventHandler, getQuery, createError, readBody, setResponseStatus */
|
import { defineEventHandler, getQuery, readBody, setResponseStatus, H3Event } from "h3";
|
||||||
import { QueryObject } from "ufo";
|
import { type ResultSetHeader } from "mysql2/promise";
|
||||||
import { H3Event } from "h3";
|
|
||||||
import { ResultSetHeader } from "mysql2/promise";
|
|
||||||
|
|
||||||
import { data, database } from "./database";
|
import { type data, database } from "./database";
|
||||||
import { isString } from "./isString";
|
import { isString } from "./isString";
|
||||||
import Snowflake from "~/utils/snowflake";
|
import Snowflake from "~/utils/snowflake";
|
||||||
import { client } from "~/utils/types/database";
|
import { type client } from "~/utils/types/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
type queryType = {
|
type queryType = {
|
||||||
type: "before" | "after" | "around",
|
type: "before" | "after" | "around",
|
||||||
|
@ -33,7 +33,7 @@ export default class BaaPagination<T extends {[k: string]: any}, keyType extends
|
||||||
* @param query the query to parse
|
* @param query the query to parse
|
||||||
* @throws if query malformed (multiple before/after/around)
|
* @throws if query malformed (multiple before/after/around)
|
||||||
*/
|
*/
|
||||||
static getLocationParameterType(query: QueryObject): queryType {
|
static getLocationParameterType(query: any): queryType {
|
||||||
const before = query.before;
|
const before = query.before;
|
||||||
const after = query.after;
|
const after = query.after;
|
||||||
const around = query.around;
|
const around = query.around;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import mysql, { Connection } from "mysql2/promise";
|
import mysql, { type Connection } from "mysql2/promise";
|
||||||
|
|
||||||
const connectionOptions: mysql.ConnectionOptions = {
|
const connectionOptions: mysql.ConnectionOptions = {
|
||||||
host: process.env.DB_HOST,
|
host: process.env.DB_HOST,
|
||||||
|
@ -12,8 +12,8 @@ const connectionOptions: mysql.ConnectionOptions = {
|
||||||
|
|
||||||
export const database =
|
export const database =
|
||||||
await mysql.createConnection(connectionOptions) as Connection & {
|
await mysql.createConnection(connectionOptions) as Connection & {
|
||||||
new: (localConnectionOptions: mysql.ConnectionOptions | undefined) => Promise<Connection>
|
new: (localConnectionOptions?: mysql.ConnectionOptions | undefined) => Promise<Connection>
|
||||||
};
|
};
|
||||||
database.new = (localConnectionOptions: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); };
|
database.new = (localConnectionOptions?: mysql.ConnectionOptions | undefined) => { return mysql.createConnection({ ...localConnectionOptions, ...connectionOptions }); };
|
||||||
|
|
||||||
export type data<T> = [T[], mysql.FieldPacket[]];
|
export type data<T> = [T[], mysql.FieldPacket[]];
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
/* global getCookie, createError */
|
import { getCookie, H3Event } from "h3";
|
||||||
import { H3Event } from "h3";
|
|
||||||
|
|
||||||
import { database, data } from "./database";
|
import { database, type data } from "./database";
|
||||||
import { user } from "~/utils/types/database";
|
import { type user } from "~/utils/types/database";
|
||||||
|
|
||||||
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export default async function getRequestingUser(e: H3Event) {
|
export default async function getRequestingUser(e: H3Event) {
|
||||||
const cookie = getCookie(e, "token");
|
const cookie = getCookie(e, "token");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global createError */
|
import { createError } from "#imports";
|
||||||
|
|
||||||
export function createValidationError(errors: Map<string, string>) {
|
export function createValidationError(errors: Map<string, string>) {
|
||||||
let message = "Invalid parameters: ";
|
let message = "Invalid parameters: ";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { CookieSerializeOptions } from "cookie-es";
|
import { type CookieSerializeOptions } from "cookie-es";
|
||||||
|
|
||||||
export const cookieSettings: CookieSerializeOptions = {
|
export const cookieSettings: CookieSerializeOptions = {
|
||||||
sameSite: "lax",
|
sameSite: "lax",
|
||||||
|
|
Loading…
Reference in a new issue