Refactor deviceInfo schema in host management to simplify structure
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit modifies the `deviceInfo` schema by removing unused fields such as `uptime`, `memory`, and `network`, streamlining the schema for better clarity and performance. The `deviceInfo` property in the `hostSchema` is updated to directly reference the `deviceInfoSchema`, enhancing code readability and maintainability.
This commit is contained in:
parent
6393ed5e3e
commit
ec5783acd8
@ -10,20 +10,12 @@ const deviceInfoSchema = new mongoose.Schema(
|
||||
release: { type: String },
|
||||
arch: { type: String },
|
||||
hostname: { type: String },
|
||||
uptime: { type: Number },
|
||||
},
|
||||
cpu: {
|
||||
cores: { type: Number },
|
||||
model: { type: String },
|
||||
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: {
|
||||
uid: { type: Number },
|
||||
gid: { type: Number },
|
||||
@ -33,8 +25,6 @@ const deviceInfoSchema = new mongoose.Schema(
|
||||
},
|
||||
process: {
|
||||
nodeVersion: { type: String },
|
||||
pid: { type: Number },
|
||||
cwd: { type: String },
|
||||
execPath: { type: String },
|
||||
},
|
||||
},
|
||||
@ -55,7 +45,7 @@ const hostSchema = new mongoose.Schema(
|
||||
active: { required: true, type: Boolean, default: true },
|
||||
connectedAt: { required: false, type: Date },
|
||||
authCode: { type: { required: false, type: String } },
|
||||
deviceInfo: { deviceInfoSchema },
|
||||
deviceInfo: deviceInfoSchema,
|
||||
otp: { type: { required: false, type: String } },
|
||||
otpExpiresAt: { required: false, type: Date },
|
||||
files: [{ type: mongoose.Schema.Types.ObjectId, ref: 'file' }],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user