Created
September 11, 2019 01:07
-
-
Save taizawa/9920c708e99b7b8fc3160ea92fe7ed7d to your computer and use it in GitHub Desktop.
api.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 設定取得 | |
export const getConfig = () => { | |
return invokeAction('getSVConfig', []) | |
} | |
// 名刺の検索 | |
export const searchNameCardsEx = (_payload = {}) => { | |
const payload = { | |
target: _.get(_payload, 'target', 'MineOnly'), // All or MineOnly or Recent | |
page: _.get(_payload, 'page', 1), | |
// TODO: remove 使ってないはず | |
// apexType: 'SmartViscaDev.SB_NameCard_S2Controller.SearchRequest', | |
word: _.get(_payload, 'word'), | |
index: _.get(_payload, 'index') | |
} | |
return invokeAction('searchNameCardsEx', [payload]) | |
} | |
// 名刺詳細データ | |
export const getNameCardDetail = (cardId = '') => { | |
return invokeAction('getNameCardDetail', [cardId]) | |
} | |
// 名刺に関する活動データ | |
export const getMyActivities = (cardId) => { | |
return invokeAction('getMyActivities', [cardId]) | |
} | |
// Todoの状況の選択リストを取得する。 | |
export const getStatus = () => { | |
return invokeAction('getTaskStatusOptions') | |
} | |
// 指定した名刺レコードIDを同じ人の名刺を持つユーザのリスト + 最新名刺の所有者ID を取得 excludeMe 自分以外 | |
export const getSameCards = (cardId) => { | |
return invokeAction('getSameCards', [cardId]) | |
} | |
// 最近更新したToDo、行動のSubjectを取得する。 | |
export const getActivitySubject = (type) => { | |
return invokeAction('getActivitySubject', [type]) | |
} | |
// 名刺に紐づけて行動、ToDoを追加、更新する。 | |
export const saveActivities = (activity) => { | |
return invokeAction('saveActivities', [activity]) | |
} | |
// 同一組織の名刺の階層表現の取得 | |
export const getCompanyTree = (cardId, mineOnly = false) => { | |
// メモ: アクション名は元々の実装がtypoしてるので、これで合ってる。 | |
return invokeAction('getCompnayTree2', [cardId, mineOnly]) | |
} | |
// タグ付きまたはリスト名付きの 名刺のリスト取得 | |
export const getTaggedNameCards = () => { | |
// メモ: アクション名は元々の実装がtypoしてるので、これで合ってる。 | |
return invokeAction('getTagdNameCards', []) | |
} | |
// 名刺をバルクで保存 | |
export const saveNameCards = (cards) => { | |
return invokeAction('saveNameCards', [cards]) | |
} | |
// 単一の名刺を保存 | |
export const saveNameCard = (card) => { | |
return saveNameCards([card]) | |
} | |
// 名刺に関連するタグを保存 | |
export const saveNameCardTag = (cardId, tags = []) => { | |
return invokeAction('saveNameCardTag', [cardId, tags]) | |
} | |
// 名刺に関連するタグを削除 | |
export const removeNameCardsTag = (cardIds, tagLabel = '', isTag = true) => { | |
return invokeAction('removeNameCardTag', [cardIds, tagLabel, isTag]) | |
} | |
// 名刺に関連するタグを削除 | |
export const removeNameCardTag = (cardId, tagLabel = '', isTag = true) => { | |
return removeNameCardsTag([cardId], tagLabel, isTag) | |
} | |
// 単一の活動を保存 | |
export const saveActivity = (activity) => { | |
return saveActivities([activity]) | |
} | |
// 指定されたオブジェクトのレコードタイプ情報のリストを返す。 | |
// objName = Task || Event | |
export const getRecordTypes = (objName) => { | |
return invokeAction('getRecordTypes', [objName]) | |
} | |
// 画像ID(imageId/bkImageId)を元に、名刺画像のURLを返却する。 | |
export const getImageUrl = (imageId) => { | |
if (!imageId) return '' | |
return `/servlet/servlet.FileDownload?file=${imageId}` | |
} | |
// レコードタイプの一覧を取得する | |
const mapResult = ([result]) => result | |
export const fetchRecordTypes = () => Promise.all([ | |
getRecordTypes('Task').then(mapResult), | |
getRecordTypes('Event').then(mapResult) | |
]).then(([task, event]) => ({ | |
task, | |
event | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment