user emojis#519
Conversation
|
@copilot create an API endpoint for creating user emojis |
Agent-Logs-Url: https://github.com/datafruits/streampusher-api/sessions/fdb8ef2c-04be-4ce1-a7cc-5e0b6fc01db0 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Done in commit 2e465c8. Added the following:
Both endpoints require authentication. |
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Done in commit 23f7bf3. Merged |
| def index | ||
| @user_emojis = current_user.user_emojis | ||
| render json: @user_emojis | ||
| end |
Agent-Logs-Url: https://github.com/datafruits/streampusher-api/sessions/145a64f6-d7df-472e-b55c-91e807ac3ed7 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
| before_action :authenticate_user! | ||
|
|
||
| def create | ||
| @user_emoji = current_user.user_emojis.new(user_emoji_params) |
There was a problem hiding this comment.
@copilot You can only create an emoji if you have enough "emoji slots" left.
You get more after leveling up.
Level 3: 1 additional slots granted
Level 4: 2 additional slots granted
Level 5: 2 additional slots granted
(some kind of gentle curve like this, maxing out at level 30 perhaps)
You must also have the DJ role.
There was a problem hiding this comment.
@copilot add the code for emoji slots to the user model
we also need to add validations to see if the user is allowed to create more emojis based on their available slots
There was a problem hiding this comment.
Done in commit ff16a23. Added:
User#emoji_slotsinUser::Rpg: returns 0 for non-DJs or level < 3, then accumulates slots per level using⌈√(level−2)⌉— yielding 1 slot at level 3, +2 at level 4, +2 at level 5, growing gently and capping at level 30.UserEmojivalidations:- User must have the DJ role
- User must have available emoji slots remaining
- Specs covering both the slot calculation and the validations.
Agent-Logs-Url: https://github.com/datafruits/streampusher-api/sessions/d767df0d-1aa3-4fe3-ab94-288ff23e39b1 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
… controller guard, and serializer host
Adds user emoji support with a model, migration, and API endpoints.
Changes Made
UserEmojiwithbelongs_to :userandhas_one_attached :imageuser_emojistable withuser_id,name, and timestampsGET /api/user_emojis— lists the current user's emojisPOST /api/user_emojis— creates a new user emoji (acceptsnameandimagevia JSON:API format)UserEmojiSerializerexposingid,name, andimage_urlhas_many :user_emojisto theUsermodelBoth API endpoints require authentication.