chore: Move to Typescript (#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously. closes #1282
This commit is contained in:
41
app/models/Integration.ts
Normal file
41
app/models/Integration.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { extendObservable, action } from "mobx";
|
||||
import BaseModel from "~/models/BaseModel";
|
||||
import { client } from "~/utils/ApiClient";
|
||||
|
||||
type Settings = {
|
||||
url: string;
|
||||
channel: string;
|
||||
channelId: string;
|
||||
};
|
||||
type Events = "documents.create" | "collections.create";
|
||||
|
||||
class Integration extends BaseModel {
|
||||
id: string;
|
||||
|
||||
type: string;
|
||||
|
||||
service: string;
|
||||
|
||||
collectionId: string;
|
||||
|
||||
events: Events;
|
||||
|
||||
settings: Settings;
|
||||
|
||||
@action
|
||||
update = async (data: Record<string, any>) => {
|
||||
await client.post("/integrations.update", {
|
||||
id: this.id,
|
||||
...data,
|
||||
});
|
||||
extendObservable(this, data);
|
||||
return true;
|
||||
};
|
||||
|
||||
@action
|
||||
delete = () => {
|
||||
return this.store.delete(this);
|
||||
};
|
||||
}
|
||||
|
||||
export default Integration;
|
||||
Reference in New Issue
Block a user