Refactor host schema to simplify deviceInfo structure
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Removed unused fields from the deviceInfo schema, including uptime, memory, and network properties, to streamline the schema. - Updated the deviceInfo reference in the host schema for improved clarity and consistency.
This commit is contained in:
parent
9416a94a23
commit
7b84114588
@ -10,20 +10,12 @@ const deviceInfoSchema = new mongoose.Schema(
|
|||||||
release: { type: String },
|
release: { type: String },
|
||||||
arch: { type: String },
|
arch: { type: String },
|
||||||
hostname: { type: String },
|
hostname: { type: String },
|
||||||
uptime: { type: Number },
|
|
||||||
},
|
},
|
||||||
cpu: {
|
cpu: {
|
||||||
cores: { type: Number },
|
cores: { type: Number },
|
||||||
model: { type: String },
|
model: { type: String },
|
||||||
speedMHz: { type: Number },
|
speedMHz: { type: Number },
|
||||||
},
|
},
|
||||||
memory: {
|
|
||||||
totalGB: { type: String }, // stored as string from .toFixed(2), could also use Number
|
|
||||||
freeGB: { type: String },
|
|
||||||
},
|
|
||||||
network: {
|
|
||||||
type: mongoose.Schema.Types.Mixed, // since it's an object with dynamic interface names
|
|
||||||
},
|
|
||||||
user: {
|
user: {
|
||||||
uid: { type: Number },
|
uid: { type: Number },
|
||||||
gid: { type: Number },
|
gid: { type: Number },
|
||||||
@ -33,8 +25,6 @@ const deviceInfoSchema = new mongoose.Schema(
|
|||||||
},
|
},
|
||||||
process: {
|
process: {
|
||||||
nodeVersion: { type: String },
|
nodeVersion: { type: String },
|
||||||
pid: { type: Number },
|
|
||||||
cwd: { type: String },
|
|
||||||
execPath: { type: String },
|
execPath: { type: String },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -55,7 +45,7 @@ const hostSchema = new mongoose.Schema(
|
|||||||
active: { required: true, type: Boolean, default: true },
|
active: { required: true, type: Boolean, default: true },
|
||||||
connectedAt: { required: false, type: Date },
|
connectedAt: { required: false, type: Date },
|
||||||
authCode: { type: { required: false, type: String } },
|
authCode: { type: { required: false, type: String } },
|
||||||
deviceInfo: { deviceInfoSchema },
|
deviceInfo: deviceInfoSchema,
|
||||||
otp: { type: { required: false, type: String } },
|
otp: { type: { required: false, type: String } },
|
||||||
otpExpiresAt: { required: false, type: Date },
|
otpExpiresAt: { required: false, type: Date },
|
||||||
files: [{ type: mongoose.Schema.Types.ObjectId, ref: 'file' }],
|
files: [{ type: mongoose.Schema.Types.ObjectId, ref: 'file' }],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user