Skip to content

对接【开源图书馆】飞书多维表格 API #96

Description

@TechQuery

Task description

  1. 获取图书数据表结构:https://open-source-bazaar.feishu.cn/wiki/KAGewsUUQiAnEokHAcHcTkz6n1b?table=tblm8grig3e36tsC&view=vewCidA31M
    title,isbn,tags,amount,donors,keepers,keeperEmails,createdAt,cover,authors,summary,recommendation,link
  2. 参考 07fe075 对接其后端 API:
    export const getServerSideProps: GetServerSideProps<Book> = async ({ params }) => {
    const bookId = +(params!.id + '');
    const { body } = await larkClient.get<Book[]>(`${API_Host}/api/open-library/books`);
    const book = body!.find(({ id }) => id === bookId);
    return book ? { props: book } : { notFound: true };
    };
  3. 将图书数据模型类声明在此:
    export class SystemModel extends BaseModel {
    searchMap = {
    activity: SearchActivityModel,
    project: SearchProjectModel,
    award: SearchAwardModel,
    NGO: SearchOrganizationModel,
    } as Record<string, Constructor<SearchModel<DataObject>>>;
  4. 将图书卡片组件声明在此:
    const SearchNameMap = ({ t }: typeof i18n): Record<string, string> => ({
    activity: t('activity'),
    project: t('open_source_projects'),
    NGO: t('NGO'),
    });
    const SearchCardMap: Record<string, CardPageProps['Card']> = {
    activity: ActivityCard,
    project: ProjectCard,
    NGO: OrganizationCard,
    };

Reward currency

TQT $

Reward amount

90

Reward payer

水歌 tech-query@fcc-cd.dev

Task source

https://open-source-bazaar.feishu.cn/record/HrTcrlZ83eVFYUc2fsFceZjKnob

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions