mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
add types to models
This commit is contained in:
1 parent
5489de2432
commit
9dc0b43737
16 files changed
+179
-73
No files matched your search
@@ -1,6 +1,22 @@
|
||||
import { Schema } from 'mongoose'
|
||||
|
||||
const fileConditionSchema = new Schema({
|
||||
export interface IFileCondition {
|
||||
path: string
|
||||
type?: string
|
||||
exists?: boolean
|
||||
}
|
||||
|
||||
export interface ICondition {
|
||||
command?: string[]
|
||||
output?: string[]
|
||||
error?: string[]
|
||||
pwd?: string[]
|
||||
files?: IFileCondition[]
|
||||
or?: ICondition[]
|
||||
not?: ICondition
|
||||
}
|
||||
|
||||
export const fileConditionSchema = new Schema<IFileCondition>({
|
||||
path: {
|
||||
type: String,
|
||||
required: true,
|
||||
@@ -12,7 +28,7 @@ const fileConditionSchema = new Schema({
|
||||
},
|
||||
})
|
||||
|
||||
const conditionSchema = new Schema({
|
||||
export const conditionSchema = new Schema<ICondition>({
|
||||
command: [String],
|
||||
output: [String],
|
||||
error: [String],
|
||||
@@ -24,5 +40,3 @@ conditionSchema.add({
|
||||
or: [conditionSchema],
|
||||
not: conditionSchema,
|
||||
})
|
||||
|
||||
export default conditionSchema
|
||||
Reference in new issue
Block a user