1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 03:03:43 +00:00

Add OrganizationService to synced services

Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Matt Gibson
2022-11-21 09:59:04 -05:00
parent 958b5daf1d
commit 71443762fe
5 changed files with 37 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
import { Jsonify } from "type-fest";
import { OrganizationUserStatusType } from "../../enums/organizationUserStatusType";
import { OrganizationUserType } from "../../enums/organizationUserType";
import { ProductType } from "../../enums/productType";
@@ -201,4 +203,11 @@ export class Organization {
get hasProvider() {
return this.providerId != null || this.providerName != null;
}
static fromJSON(json: Jsonify<Organization>) {
return Object.assign(new Organization(), json, {
familySponsorshipLastSyncDate: new Date(json.familySponsorshipLastSyncDate),
familySponsorshipValidUntil: new Date(json.familySponsorshipValidUntil),
});
}
}

View File

@@ -8,7 +8,7 @@ import { Organization } from "../../models/domain/organization";
import { isSuccessfullyCompleted } from "../../types/syncEventArgs";
export class OrganizationService implements OrganizationServiceAbstraction {
private _organizations = new BehaviorSubject<Organization[]>([]);
protected _organizations = new BehaviorSubject<Organization[]>([]);
organizations$ = this._organizations.asObservable();