forked from FoundKeyGang/FoundKey
Refactor
This commit is contained in:
parent
2547891f94
commit
321f61f1cb
2 changed files with 21 additions and 4 deletions
|
@ -2,10 +2,10 @@ import create from './create';
|
||||||
import performDeleteActivity from './delete';
|
import performDeleteActivity from './delete';
|
||||||
import follow from './follow';
|
import follow from './follow';
|
||||||
import undo from './undo';
|
import undo from './undo';
|
||||||
import { IObject } from '../type';
|
import { Object } from '../type';
|
||||||
import { IRemoteUser } from '../../../models/user';
|
import { IRemoteUser } from '../../../models/user';
|
||||||
|
|
||||||
const self = async (actor: IRemoteUser, activity: IObject): Promise<void> => {
|
const self = async (actor: IRemoteUser, activity: Object): Promise<void> => {
|
||||||
switch (activity.type) {
|
switch (activity.type) {
|
||||||
case 'Create':
|
case 'Create':
|
||||||
await create(actor, activity);
|
await create(actor, activity);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export type Object = { [x: string]: any };
|
export type obj = { [x: string]: any };
|
||||||
|
|
||||||
export interface IObject {
|
export interface IObject {
|
||||||
'@context': string | object | any[];
|
'@context': string | obj | obj[];
|
||||||
type: string;
|
type: string;
|
||||||
id?: string;
|
id?: string;
|
||||||
summary?: string;
|
summary?: string;
|
||||||
|
@ -39,6 +39,10 @@ export interface ICreate extends IActivity {
|
||||||
type: 'Create';
|
type: 'Create';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IDelete extends IActivity {
|
||||||
|
type: 'Delete';
|
||||||
|
}
|
||||||
|
|
||||||
export interface IUndo extends IActivity {
|
export interface IUndo extends IActivity {
|
||||||
type: 'Undo';
|
type: 'Undo';
|
||||||
}
|
}
|
||||||
|
@ -46,3 +50,16 @@ export interface IUndo extends IActivity {
|
||||||
export interface IFollow extends IActivity {
|
export interface IFollow extends IActivity {
|
||||||
type: 'Follow';
|
type: 'Follow';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IAccept extends IActivity {
|
||||||
|
type: 'Accept';
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Object =
|
||||||
|
ICollection |
|
||||||
|
IOrderedCollection |
|
||||||
|
ICreate |
|
||||||
|
IDelete |
|
||||||
|
IUndo |
|
||||||
|
IFollow |
|
||||||
|
IAccept;
|
||||||
|
|
Loading…
Reference in a new issue