CentralBackend/models/CompanyUser.js
2025-09-07 12:44:01 +02:00

27 lines
943 B
JavaScript

const User = require('./User');
class CompanyUser extends User {
constructor(id, email, password, companyName, companyPhone, contactPersonName, contactPersonPhone, registrationNumber, createdAt, updatedAt, role) {
super(id, email, password, 'company', createdAt, updatedAt, role);
this.companyName = companyName;
this.companyPhone = companyPhone;
this.contactPersonName = contactPersonName;
this.contactPersonPhone = contactPersonPhone;
this.registrationNumber = registrationNumber;
}
// Override getPublicData to include company-specific fields
getPublicData() {
const baseData = super.getPublicData();
return {
...baseData,
companyName: this.companyName,
companyPhone: this.companyPhone,
contactPersonName: this.contactPersonName,
contactPersonPhone: this.contactPersonPhone,
registrationNumber: this.registrationNumber
};
}
}
module.exports = CompanyUser;