add types to models

This commit is contained in:
wancat committed 2024-02-19 18:05:01 +08:00
1 parent 5489de2432
commit 9dc0b43737
16 files changed
+179 -73

No files matched your search

+14 -5
View File
@@ -1,8 +1,19 @@
import { model, Schema } from 'mongoose'
import { model, Schema, Types } from 'mongoose'
const Command = model(
export interface ICommand {
session: Types.ObjectId
pwd: string
command: string
output?: string
error?: string
stage?: string
createdAt: Date
updatedAt: Date
}
export const Command = model<ICommand>(
'Command',
new Schema(
new Schema<ICommand>(
{
session: {
type: Schema.ObjectId,
@@ -33,5 +44,3 @@ const Command = model(
{ timestamps: true }
)
)
export default Command