Skip to content

Commit

Permalink
feat: added types to tenant model
Browse files Browse the repository at this point in the history
Part of issue oaeproject#11
  • Loading branch information
brecke committed Jun 16, 2021
1 parent c1377c3 commit 4c3a9f5
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/models/tenant.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
// import { computed, observable, makeAutoObservable } from 'mobx';
import { prop } from 'ramda';

// @ts-check
export class Tenant {
store; //: null;
alias; //: string;
displayName; //: string;
isGuestTenant; //: boolean;
isPrivate; //: boolean;
emailDomains; //: string[];
/** @type {string} */
store;

constructor(tenantData) {
// TODO do we need all these attributes to be observable?
/*
makeAutoObservable(this, {
// alias: observable,
displayName: observable,
isGuestTenant: observable,
isPrivate: observable,
asBackend: computed,
});
*/
/** @type {string} */
alias;

/** @type {string} */
displayName;

/** @type {boolean} */
isGuestTenant;

this.alias = prop('alias', tenantData);
this.displayName = prop('displayName', tenantData);
this.isGuestTenant = prop('isGuestTenant', tenantData);
this.isPrivate = prop('isPrivate', tenantData);
this.emailDomains = prop('emailDomains', tenantData);
/** @type {boolean} */
isPrivate;

/** @type {string[]} */
emailDomains;

constructor(tenantData) {
this.alias = tenantData?.alias;
this.displayName = tenantData?.displayName;
this.isGuestTenant = tenantData?.isGuestTenant;
this.isPrivate = tenantData?.isPrivate;
this.emailDomains = tenantData?.emailDomains;
}

/**
* Dummy method
*/
get asBackend() {
return {
alias: this.alias,
Expand Down

0 comments on commit 4c3a9f5

Please sign in to comment.