feat(frontend): 今日誕生日のフォロー中のユーザーを一覧表示できるウィジェットを追加 (#12450)
* (add) 今日誕生日のフォロイー一覧表示 * Update Changelog * Update Changelog * 実装漏れ * create index * (fix) index
This commit is contained in:
		| @@ -42,6 +42,12 @@ export const meta = { | ||||
| 			code: 'FORBIDDEN', | ||||
| 			id: 'f6cdb0df-c19f-ec5c-7dbb-0ba84a1f92ba', | ||||
| 		}, | ||||
|  | ||||
| 		birthdayInvalid: { | ||||
| 			message: 'Birthday date format is invalid.', | ||||
| 			code: 'BIRTHDAY_DATE_FORMAT_INVALID', | ||||
| 			id: 'a2b007b9-4782-4eba-abd3-93b05ed4130d', | ||||
| 		}, | ||||
| 	}, | ||||
| } as const; | ||||
|  | ||||
| @@ -59,6 +65,8 @@ export const paramDef = { | ||||
| 			nullable: true, | ||||
| 			description: 'The local host is represented with `null`.', | ||||
| 		}, | ||||
|  | ||||
| 		birthday: { type: 'string', nullable: true }, | ||||
| 	}, | ||||
| 	anyOf: [ | ||||
| 		{ required: ['userId'] }, | ||||
| @@ -117,6 +125,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- | ||||
| 				.andWhere('following.followerId = :userId', { userId: user.id }) | ||||
| 				.innerJoinAndSelect('following.followee', 'followee'); | ||||
|  | ||||
| 			if (ps.birthday) { | ||||
| 				try { | ||||
| 					const d = new Date(ps.birthday); | ||||
| 					d.setHours(0, 0, 0, 0); | ||||
| 					const birthday = `${(d.getMonth() + 1).toString().padStart(2, '0')}-${d.getDate().toString().padStart(2, '0')}`; | ||||
| 					const birthdayUserQuery = this.userProfilesRepository.createQueryBuilder('user_profile'); | ||||
| 					birthdayUserQuery.select('user_profile.userId') | ||||
| 						.where(`SUBSTR(user_profile.birthday, 6, 5) = '${birthday}'`); | ||||
|  | ||||
| 					query.andWhere(`following.followeeId IN (${ birthdayUserQuery.getQuery() })`); | ||||
| 				} catch (err) { | ||||
| 					throw new ApiError(meta.errors.birthdayInvalid); | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			const followings = await query | ||||
| 				.limit(ps.limit) | ||||
| 				.getMany(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 かっこかり
					かっこかり