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

feat: implementions of announcement creation function #8715

Open
wants to merge 36 commits into
base: feat/announcement-function
Choose a base branch
from

Conversation

WNomunomu
Copy link
Contributor

@WNomunomu WNomunomu commented Apr 12, 2024

タスク

https://redmine.weseek.co.jp/issues/134084
https://redmine.weseek.co.jp/issues/134085

概要

  • announcementを作成、永続化できるようにしました。
  • announcementからinappnotificationを作成、永続化できるようにしました。

変更点

  • announcementを作成し、dbに保存するapiの実装
  • 作成したapiをクライアントサイドから叩くための関数の実装

セルフチェック

  • コンフリクト解消したか
  • 余計なコードは残っていないか
  • 適切にメモ化したか
  • 責務の問題はクリアしているか
  • CIは通っているか
  • PRの内容は適切にかけているか

@WNomunomu WNomunomu changed the base branch from master to feat/announcement-function April 12, 2024 08:09
@WNomunomu WNomunomu changed the base branch from feat/announcement-function to master May 24, 2024 00:08
Copy link

changeset-bot bot commented May 27, 2024

⚠️ No Changeset found

Latest commit: 615e657

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

reg-suit bot commented May 27, 2024

reg-suit detected visual differences.

Check this report, and review them.


⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫⚫
🔵🔵🔵🔵🔵

What do the circles mean? The number of circles represent the number of changed images.
🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items

How can I change the check status? If reviewers approve this PR, the reg context status will be green automatically.

@WNomunomu WNomunomu changed the base branch from master to feat/announcement-function June 23, 2024 06:49

const loginRequiredStrictly = require('~/server/middlewares/login-required')(crowi);

router.post('/', loginRequiredStrictly, async(req: CrowiRequest) => {
Copy link
Member

Choose a reason for hiding this comment

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

  • pageId は req.params で取れる方が良さそう
  • express-valudator を使ってバリデーションもする

apps/app/src/server/routes/apiv3/announcement.ts Outdated Show resolved Hide resolved
apps/app/src/client/util/announcement-utils.ts Outdated Show resolved Hide resolved
apps/app/src/server/service/announcement.ts Outdated Show resolved Hide resolved
@WNomunomu WNomunomu changed the base branch from feat/announcement-function to master August 5, 2024 12:00
@WNomunomu WNomunomu changed the base branch from master to feat/announcement-function August 5, 2024 12:01
apps/app/src/server/routes/apiv3/announcement.ts Outdated Show resolved Hide resolved

const params: ParamsForAnnouncement = req.body;

const page = await Page.findById(params.pageId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

req.paramsではpageIdが正しく取得できなかったため、この形にしています。

Copy link
Member

Choose a reason for hiding this comment

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

クライアントのリクエスト方法がパスパラメーターで取得できるかたちになっていないのでは?
https://github.com/weseek/growi/pull/8715/files#diff-16e65c79c9018f437410fdf1211d572707905ec324e3b3129c795555aa364a5cR13

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/:id を用いることで、pageIdをパスパラメータで取得できるようにしました。


const params: ParamsForAnnouncement = req.body;

const page = await Page.findById(params.pageId);
Copy link
Member

Choose a reason for hiding this comment

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

クライアントのリクエスト方法がパスパラメーターで取得できるかたちになっていないのでは?
https://github.com/weseek/growi/pull/8715/files#diff-16e65c79c9018f437410fdf1211d572707905ec324e3b3129c795555aa364a5cR13


return router;

};
Copy link
Member

Choose a reason for hiding this comment

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

これも features ディレクトリで良さそう

Copy link
Contributor Author

Choose a reason for hiding this comment

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

こちら移動させていただきました。


export interface ParamsForAnnouncement extends Omit<IAnnouncement, 'receivers'> {
receivers: Ref<IUser>[]
}
Copy link
Member

Choose a reason for hiding this comment

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

これも featues ディレクトリで良さそう

Copy link
Contributor Author

Choose a reason for hiding this comment

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

こちらも移動しました。

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

Successfully merging this pull request may close these issues.

2 participants