added / fixed some types

This commit is contained in:
mrfry 2022-03-14 19:35:42 +01:00
parent 5f12284bb8
commit bc5c293539
41 changed files with 4378 additions and 8304 deletions

View file

@ -1,15 +1,19 @@
import express from 'express'
import { SearchResultQuestion } from '../utils/classes'
import type { Database } from 'better-sqlite3'
import type { Socket as SocketIoSocket } from 'socket.io'
import http from 'http'
import https from 'https'
export interface QuestionData {
type: string
date?: Date | number
images?: Array<string>
hashedImages?: Array<string>
possibleAnswers?:
| Array<string>
| Array<{
text: string
selectedByUser: boolean
}>
possibleAnswers?: Array<{
text: string
selectedByUser: boolean
}>
}
export interface Question {
@ -60,11 +64,6 @@ export interface User {
created: Date
}
export interface ModuleType {
app: express.Application
dailyAction?: Function
}
export interface User {
id: number
pw: string
@ -74,7 +73,8 @@ export interface User {
createdBy: number
}
export interface Request extends express.Request {
export interface Request<T = any> extends express.Request {
body: T
cookies: any
session: any
busboy: any
@ -85,9 +85,47 @@ export interface SubmoduleData {
app: express.Application
url: string
publicdirs: Array<string>
userDB?: any
userDB?: Database
nextdir?: string
httpServer: any
moduleSpecificData?: any
httpsServer?: any
httpServer: http.Server
httpsServer: https.Server
}
export interface QuestionFromScript {
questions: Array<Question>
testUrl: string
subj: string
}
export interface DbSearchResult {
message?: string
recievedData?: string
question: Question
result: SearchResultQuestion[]
success: boolean
}
export interface RegisteredUserEntry {
cid: string
version: string
installSource: string
date: string
userAgent: string
uid: number
loginDate: string
}
export interface Submodule {
dailyAction?: () => void
load?: () => void
}
export interface ModuleType {
app: express.Application
dailyAction?: Function
}
export interface Socket extends SocketIoSocket {
user: User
}