CentralBackend/models/Matrix.js
2025-10-16 16:34:56 +02:00

29 lines
944 B
JavaScript

class Matrix {
constructor({
// config (create)
name,
masterTopUserId,
masterTopUserEmail,
// ego activation (optional legacy fields)
rootUserId,
egoActivatedAt,
lastBfsFillAt,
immediateChildrenCount,
firstFreePosition
}) {
this.name = typeof name === 'string' ? name : null;
this.masterTopUserId = masterTopUserId !== undefined ? Number(masterTopUserId) : null;
this.masterTopUserEmail = masterTopUserEmail || null;
this.rootUserId = rootUserId !== undefined ? Number(rootUserId) : null;
this.egoActivatedAt = egoActivatedAt || null;
this.lastBfsFillAt = lastBfsFillAt || null;
this.immediateChildrenCount = immediateChildrenCount !== undefined ? Number(immediateChildrenCount || 0) : null;
this.firstFreePosition = firstFreePosition !== undefined
? (firstFreePosition === null ? null : Number(firstFreePosition))
: null;
}
}
module.exports = Matrix;