fix: Simlify types, convert interfaces into types
This commit is contained in:
parent
c59cc1e144
commit
ec7dbeb0ae
@ -1,10 +1,10 @@
|
|||||||
import cassandra from 'cassandra-driver';
|
import cassandra from 'cassandra-driver';
|
||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
|
|
||||||
interface Messages {
|
type Messages = {
|
||||||
messages: cassandra.types.Row[] | null;
|
messages: cassandra.types.Row[] | null;
|
||||||
error: Error | null;
|
error: Error | null;
|
||||||
}
|
};
|
||||||
|
|
||||||
function createDelay(ms: number) {
|
function createDelay(ms: number) {
|
||||||
return new Promise((res) => setTimeout(res, ms));
|
return new Promise((res) => setTimeout(res, ms));
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
|
|
||||||
interface Profile {
|
type Profile = {
|
||||||
username: string;
|
username: string;
|
||||||
image: string;
|
image: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
class AuthDb {
|
class AuthDb {
|
||||||
private client = new Database('./src/lib/server/db/users.db');
|
private client = new Database('./src/lib/server/db/users.db');
|
||||||
|
@ -3,13 +3,13 @@ import * as Minio from 'minio';
|
|||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
interface ClientParams {
|
type ClientParams = {
|
||||||
endPoint: string;
|
endPoint: string;
|
||||||
port: number;
|
port: number;
|
||||||
accessKey: string;
|
accessKey: string;
|
||||||
secretKey: string;
|
secretKey: string;
|
||||||
useSSL: boolean;
|
useSSL: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
class MinioClient {
|
class MinioClient {
|
||||||
private client: Minio.Client;
|
private client: Minio.Client;
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
export interface TypeMessage {
|
export type TypeMessage = {
|
||||||
message: string;
|
message: string;
|
||||||
imageSrc: string;
|
imageSrc: string;
|
||||||
user: string;
|
user: string;
|
||||||
uid: string;
|
uid: string;
|
||||||
timestamp: Date;
|
timestamp: Date;
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface TypeFullMessage {
|
export type TypeFullMessage = TypeMessage & {
|
||||||
channel: string;
|
channel: string;
|
||||||
message: string;
|
};
|
||||||
imageSrc: string;
|
|
||||||
user: string;
|
|
||||||
uid: string;
|
|
||||||
timestamp: Date;
|
|
||||||
}
|
|
||||||
|
@ -6,10 +6,10 @@ import { redirect } from '@sveltejs/kit';
|
|||||||
import { superValidate } from 'sveltekit-superforms';
|
import { superValidate } from 'sveltekit-superforms';
|
||||||
import { zod } from 'sveltekit-superforms/adapters';
|
import { zod } from 'sveltekit-superforms/adapters';
|
||||||
|
|
||||||
interface Profile {
|
type Profile = {
|
||||||
username: string;
|
username: string;
|
||||||
image: string;
|
image: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export async function load({ request }) {
|
export async function load({ request }) {
|
||||||
const session = await auth.api.getSession({
|
const session = await auth.api.getSession({
|
||||||
|
@ -4,11 +4,11 @@ import type { TypeMessage } from '$lib/types';
|
|||||||
import { error, redirect } from '@sveltejs/kit';
|
import { error, redirect } from '@sveltejs/kit';
|
||||||
import { auth } from '$lib/server/db/auth';
|
import { auth } from '$lib/server/db/auth';
|
||||||
|
|
||||||
interface ChannelLoad {
|
type ChannelLoad = {
|
||||||
messages: TypeMessage[];
|
messages: TypeMessage[];
|
||||||
currentUserID: string;
|
currentUserID: string;
|
||||||
currentUserName: string;
|
currentUserName: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export async function load({ params, request }): Promise<ChannelLoad> {
|
export async function load({ params, request }): Promise<ChannelLoad> {
|
||||||
const session = await auth.api.getSession({
|
const session = await auth.api.getSession({
|
||||||
|
Loading…
Reference in New Issue
Block a user