Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

書籍のcopyrightを記入できるようにする #15

Merged
merged 4 commits into from
Nov 18, 2018

Conversation

mogya
Copy link
Contributor

@mogya mogya commented Nov 15, 2018

Origin

書籍のメタデータを記入できるようにする #1

現状

本を選んで、サイドバーから書籍設定を選ぶと
flight_books

書籍設定画面ぽいものを作った
flight_books

  • 著者[] とかは難しいのであとに回して、まずは「著作権」copyrigthをbookに保存できるようにしたい
  • Book.tsのBookEntityにcopyrightを追加した結果、これは保存できるようになった
  • 著者[] と 技術[] については別PRに分ける

<NavItem label="プロジェクト設定" />
<NavItem label="出版設定" />
<router-link :to="{ name: 'bookSetting', params: { id: presenter.book.identifier }}">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

わかったことその1

このアプリ、URLにIDを持つのですが、そのIDが何であるかが場面によって勝手に変わる( restfulとかじゃないぽい )
で、BookRepositryはそのIDをもとにBookを生成するので、Bookを扱いたいときはidにbookのidentifierをわたしてあげる必要がある。

よくわからんままにbuildSettingのコードをコピって params: { id: presenter.projectTree.props.identifier }}"とかするとbookがnullのままになってハマった。

@@ -6,6 +6,7 @@ export interface IBook {
name: string;
owner: string;
genre?: number;
copyright: string;
Copy link
Contributor Author

@mogya mogya Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BookRepositoryやUsecaseはみんなBookEntityとIBookを元に型を定義しているから、ここにフィールドを追加したらstateにもcopyrightが追加されると思うのだけれど..何故かそうならない。どっか気づいていない謎メカニズムがあるぽいのだけれど、見つけられなくてもがいています

});

const item = new BookEntity({
...this.presenter.Book,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここにフィールドを追加したらstateにもcopyrightが追加される ...

コード見た感じは僕もそう思います。
見当違いだったら申し訳ないんですけどもしかして小文字が○です?
this.presenter.Book -> this.presenter.book

book: item ? new BookEntity(item).props : null

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あとは別の usecase 越しに store 更新されててそのへんが影響してるとか?

const bookEntity = BookEntity.newEntity({ name, owner, projectTreeRef });

手元で動いてないんでよくわかってないままコメントしてます。
見当違いだったらスルーしてください 🙏

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ほんとだ、Bookをbookにしたら治りました!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

動いたのでPushしました。ありがとうございます!

@mogya mogya changed the title WIP 書籍のメタデータを記入できるようにする 書籍のメタデータを記入できるようにする Nov 18, 2018
@mogya mogya changed the title 書籍のメタデータを記入できるようにする 書籍のcopyrightを記入できるようにする Nov 18, 2018
@ku-suke ku-suke merged commit a83043c into ku-suke:master Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants