chore: Improve typings around model methods (#6324)

This commit is contained in:
Tom Moor
2023-12-28 20:11:27 -04:00
committed by GitHub
parent ed1f345326
commit 55a55376c6
15 changed files with 89 additions and 65 deletions

View File

@@ -10,6 +10,7 @@ import {
NavigationNode,
} from "@shared/types";
import Collection from "~/models/Collection";
import { Properties } from "~/types";
import { client } from "~/utils/ApiClient";
import RootStore from "./RootStore";
import Store from "./base/Store";
@@ -165,14 +166,14 @@ export default class CollectionsStore extends Store<Collection> {
}
};
async update(params: Record<string, any>): Promise<Collection> {
async update(params: Properties<Collection>): Promise<Collection> {
const result = await super.update(params);
// If we're changing sharing permissions on the collection then we need to
// remove all locally cached policies for documents in the collection as they
// are now invalid
if (params.sharing !== undefined) {
this.rootStore.documents.inCollection(params.id).forEach((document) => {
this.rootStore.documents.inCollection(result.id).forEach((document) => {
this.rootStore.policies.remove(document.id);
});
}