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.
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.