63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { Document, Schema } from "mongoose";
|
|
import MainModel from "../../../connect/mongoose.ts";
|
|
|
|
interface ICommonBase {
|
|
type: string;
|
|
}
|
|
interface IPointsConveyor extends ICommonBase {
|
|
points?: {
|
|
Uuid: string;
|
|
position: [number, number, number];
|
|
rotation: [number, number, number];
|
|
}[];
|
|
}
|
|
interface IPoint extends ICommonBase {
|
|
point?: {
|
|
Uuid: string;
|
|
position: [number, number, number];
|
|
rotation: [number, number, number];
|
|
};
|
|
}
|
|
export interface AssetData extends Document {
|
|
modelUuid: string;
|
|
modelfileID: string;
|
|
modelName: string;
|
|
isLocked: boolean;
|
|
type: string;
|
|
isVisible: boolean;
|
|
isArchive: false;
|
|
position: [];
|
|
rotation: {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
};
|
|
speed: number | string;
|
|
eventData: IPoint | IPointsConveyor;
|
|
}
|
|
|
|
const assetDataSchema: Schema = new Schema({
|
|
isArchive: { type: Boolean, default: false },
|
|
modelUuid: { type: String },
|
|
modelfileID: { type: String },
|
|
modelName: { type: String },
|
|
type: { type: String },
|
|
position: { type: Array },
|
|
rotation: {
|
|
x: { type: Number },
|
|
y: { type: Number },
|
|
z: { type: Number },
|
|
},
|
|
speed: { type: Schema.Types.Mixed },
|
|
isLocked: { type: Boolean },
|
|
isVisible: { type: Boolean },
|
|
eventData: {
|
|
type: Schema.Types.Mixed,
|
|
},
|
|
});
|
|
|
|
const assetModel = (db: string) => {
|
|
return MainModel(db, "Assets", assetDataSchema, "Assets");
|
|
};
|
|
export default assetModel;
|