oneuptime/Common/Models/ContainerSecurity.ts

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-04-26 20:24:24 +00:00
import mongoose, {
RequiredFields,
UniqueFields,
EncryptedFields,
Schema,
} from '../Infrastructure/ORM';
const schema: Schema = new Schema(
{
name: String,
slug: { type: String, index: true },
dockerCredential: {
type: Schema.Types.ObjectId,
ref: 'DockerCredential',
index: true,
},
imagePath: String,
imageTags: String,
componentId: {
type: Schema.Types.ObjectId,
ref: 'Component',
index: true,
},
resourceCategory: {
type: Schema.Types.ObjectId,
ref: 'ResourceCategory',
index: true,
},
deleted: {
type: Boolean,
default: false,
},
deleteAt: Date,
lastScan: Date,
scanned: { type: Boolean, default: false },
scanning: { type: Boolean, default: false },
},
{ timestamps: true } //Automatically adds createdAt and updatedAt to the schema
);
export const requiredFields: RequiredFields = schema.requiredPaths();
export const uniqueFields: UniqueFields = [];
export const encryptedFields: EncryptedFields = [];
export const slugifyField: string = '';
export default mongoose.model('ContainerSecurity', schema);