2018-03-31 13:55:00 +03:00
|
|
|
import create from './create';
|
2018-04-03 11:50:52 +03:00
|
|
|
import performDeleteActivity from './delete';
|
2018-04-02 13:50:40 +03:00
|
|
|
import follow from './follow';
|
2018-04-03 10:33:16 +03:00
|
|
|
import undo from './undo';
|
2018-04-03 14:09:26 +03:00
|
|
|
import Resolver from '../resolver';
|
2018-04-04 17:12:35 +03:00
|
|
|
import { IObject } from '../type';
|
|
|
|
|
|
|
|
export default async (parentResolver: Resolver, actor, activity: IObject): Promise<void> => {
|
|
|
|
switch (activity.type) {
|
|
|
|
case 'Create':
|
|
|
|
await create(parentResolver, actor, activity);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Delete':
|
|
|
|
await performDeleteActivity(parentResolver, actor, activity);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Follow':
|
|
|
|
await follow(parentResolver, actor, activity);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Undo':
|
|
|
|
await undo(parentResolver, actor, activity);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
console.warn(`unknown activity type: ${activity.type}`);
|
|
|
|
return null;
|
|
|
|
}
|
2018-04-01 15:17:46 +03:00
|
|
|
};
|