[AC-1890] Update the collection PUT/POST response models to include collection permission details (#7512)

This commit is contained in:
Shane Melton 2024-01-24 08:26:43 -08:00 committed by GitHub
parent 8d177040ed
commit 622791307a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
import { CollectionRequest } from "@bitwarden/common/vault/models/request/collection.request";
import {
CollectionAccessDetailsResponse,
CollectionDetailsResponse,
CollectionResponse,
} from "@bitwarden/common/vault/models/response/collection.response";
@ -51,10 +52,10 @@ export class CollectionAdminService {
return view;
}
async save(collection: CollectionAdminView): Promise<CollectionResponse> {
async save(collection: CollectionAdminView): Promise<CollectionDetailsResponse> {
const request = await this.encrypt(collection);
let response: CollectionResponse;
let response: CollectionDetailsResponse;
if (collection.id == null) {
response = await this.apiService.postCollection(collection.organizationId, request);
collection.id = response.id;

View File

@ -122,6 +122,7 @@ import { AttachmentResponse } from "../vault/models/response/attachment.response
import { CipherResponse } from "../vault/models/response/cipher.response";
import {
CollectionAccessDetailsResponse,
CollectionDetailsResponse,
CollectionResponse,
} from "../vault/models/response/collection.response";
import { SyncResponse } from "../vault/models/response/sync.response";
@ -277,7 +278,7 @@ export abstract class ApiService {
postCollection: (
organizationId: string,
request: CollectionRequest,
) => Promise<CollectionResponse>;
) => Promise<CollectionDetailsResponse>;
putCollectionUsers: (
organizationId: string,
id: string,
@ -287,7 +288,7 @@ export abstract class ApiService {
organizationId: string,
id: string,
request: CollectionRequest,
) => Promise<CollectionResponse>;
) => Promise<CollectionDetailsResponse>;
deleteCollection: (organizationId: string, id: string) => Promise<any>;
deleteManyCollections: (organizationId: string, collectionIds: string[]) => Promise<any>;
deleteCollectionUser: (

View File

@ -133,6 +133,7 @@ import { AttachmentResponse } from "../vault/models/response/attachment.response
import { CipherResponse } from "../vault/models/response/cipher.response";
import {
CollectionAccessDetailsResponse,
CollectionDetailsResponse,
CollectionResponse,
} from "../vault/models/response/collection.response";
import { SyncResponse } from "../vault/models/response/sync.response";
@ -770,7 +771,7 @@ export class ApiService implements ApiServiceAbstraction {
async postCollection(
organizationId: string,
request: CollectionRequest,
): Promise<CollectionResponse> {
): Promise<CollectionDetailsResponse> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/collections",
@ -778,14 +779,14 @@ export class ApiService implements ApiServiceAbstraction {
true,
true,
);
return new CollectionResponse(r);
return new CollectionDetailsResponse(r);
}
async putCollection(
organizationId: string,
id: string,
request: CollectionRequest,
): Promise<CollectionResponse> {
): Promise<CollectionDetailsResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/collections/" + id,
@ -793,7 +794,7 @@ export class ApiService implements ApiServiceAbstraction {
true,
true,
);
return new CollectionResponse(r);
return new CollectionDetailsResponse(r);
}
async putCollectionUsers(