code-corps / code-corps/code-corps-ember
Add route to fulfill invites
- 主要語言
- JavaScript
- 星號
- 120
- 分支
- 75
- PR 合併指標
- 30 天內沒有已合併 PR
描述
# Problem
We need a route (at a path to be decided on here) which will be used to claim a user invite
## Subtasks
- [ ] Decide on path for the route through discussion in this issue
- [ ] Add route to app
- [ ] Loads invite, has a 404/not_found substate
- [ ] Displays different informational UI depending on the invite being for a project or just a plain invite
- [ ] Displays form UI for user account creation - mostly the same as the signup form
- [ ] When creating the user, add invite ID to the new user payload
- [ ] Write acceptance test for success case for a plain invite
- [ ] Write acceptance test for success case for a project invite
- [ ] Write fail case for an invite not found
- [ ] Write any integration tests for components added as part of the solution
## Notes
### How to specify an invite id
- We could add the invite id as a virtual attribute and push it as part of the payload. Would require a virtual attribute API side as well
- We could ad a `hasMany('claimed-invites')` to the user model, since the API already has it, then push the loaded invite into the association and save that way. Should end as `claimed_invite_ids` on the API, but would require rewriting our API approach slightly
- My prefered approach
- save a plain user, but when calling save, specify `user.save({ inviteId: userInvite.id })`
- modify user adapter by overriding
```Javascript
urlForCreateRecord(modelName, snapshot) {
if (snapshot.inviteId) {
return this._super(...arguments) + `?invite_id=${snapshot.inviteId}`
} else {
return this._super(...arguments);
}
}
```
This way, we keep the create "switch" separate from the create attributes, since it becomes a query param. At the same time, the API should keep working.
## References
Requires code-corps/code-corps-api#1351 merged, but can be worked on using mirage in the interim.
貢獻指南
研究方向
先解析此 issue 中的 route path,然後檢查現有的 signup form、app routing 和 user adapter。在 API 相依性尚待處理期間使用 Mirage。完成的標準是:route 能處理缺少的、一般的和專案邀請,使用邀請 ID 建立使用者,並且為列出的情況提供 acceptance 和 integration 覆蓋。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- authentication, frontend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100