mirror of
https://github.com/bitwarden/browser
synced 2026-01-08 03:23:50 +00:00
[PM-24227] Enable TS-strict for Collection Domain models (#15765)
* wip ts-strict * wip ts-strict * wip * cleanup * cleanup * fix story * fix story * fix story * wip * clean up CollectionAdminView construction * fix deprecated function call * fix cli * clean up * fix story * wip * fix cli * requested changes * clean up, fixing minor bugs, more type saftey * assign props in static ctor, clean up
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { SelectionReadOnlyRequest } from "@bitwarden/common/admin-console/models/request/selection-read-only.request";
|
||||
|
||||
import { Collection } from "./collection";
|
||||
import { EncString } from "@bitwarden/common/key-management/crypto/models/enc-string";
|
||||
|
||||
export class CollectionRequest {
|
||||
name: string;
|
||||
externalId: string;
|
||||
externalId: string | undefined;
|
||||
groups: SelectionReadOnlyRequest[] = [];
|
||||
users: SelectionReadOnlyRequest[] = [];
|
||||
|
||||
constructor(collection?: Collection) {
|
||||
if (collection == null) {
|
||||
return;
|
||||
constructor(c: {
|
||||
name: EncString;
|
||||
users?: SelectionReadOnlyRequest[];
|
||||
groups?: SelectionReadOnlyRequest[];
|
||||
externalId?: string;
|
||||
}) {
|
||||
if (!c.name || !c.name.encryptedString) {
|
||||
throw new Error("Name not provided for CollectionRequest.");
|
||||
}
|
||||
|
||||
this.name = c.name.encryptedString;
|
||||
this.externalId = c.externalId;
|
||||
|
||||
if (c.groups) {
|
||||
this.groups = c.groups;
|
||||
}
|
||||
if (c.users) {
|
||||
this.users = c.users;
|
||||
}
|
||||
this.name = collection.name ? collection.name.encryptedString : null;
|
||||
this.externalId = collection.externalId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user