Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Feature: User can edit their posts. #38

Open
6 of 15 tasks
Tracked by #9
jojobii-arks opened this issue Jun 10, 2022 · 0 comments
Open
6 of 15 tasks
Tracked by #9

Feature: User can edit their posts. #38

jojobii-arks opened this issue Jun 10, 2022 · 0 comments
Assignees
Labels
new feature New feature or request

Comments

@jojobii-arks
Copy link
Collaborator

jojobii-arks commented Jun 10, 2022

Sub Feature of #9

Prereqs:

✅ Task List

☁️ Server

  • Create new authorized endpoint /api/posts/edit/:id that runs auth middleware and takes a JSON object payload with edit details
  • Validate 'x-access-token' via auth middleware and set req.user to payload.
  • Parse through data same way as done for /api/upload/
  • Use SQL Update to update where postId === and userId === req.user.id (the where clause will return negative if payload userid is not equal, and there will be no rows returning)
  • Validate inputs with post schema
  • Throw 404s if post doesn't exist
  • Test with HTTPie
  • Handle all errors and respond to the client

⚡ Client

  • Add context menu <SymbolArtContextMenu> positioned to right side of <SymbolArtCard> title, displaying edit and delete post options. Only visible if the post's userId matches the current AppContext.userId
    • Attach the same component to <SinglePostSingleArt>
  • Create form modal components that handle editing and deleting, using <DaisyModal> to handle displaying it.
  • For edit form, take prop of current Symbol Art data and prefill form state and preview image with the data.
    • Use the same form input logic as upload.jsx
    • Handle submit by sending a fetch request with the current AppContext.usertoken to /api/posts/edit/:id, and close modal upon success.
@jojobii-arks jojobii-arks added the new feature New feature or request label Jun 10, 2022
@jojobii-arks jojobii-arks self-assigned this Jun 10, 2022
@jojobii-arks jojobii-arks pinned this issue Jun 10, 2022
@jojobii-arks jojobii-arks moved this from Todo to In Progress in Symbol Art Vault Jun 11, 2022
@jojobii-arks jojobii-arks moved this from In Progress to Todo in Symbol Art Vault Jun 14, 2022
@jojobii-arks jojobii-arks unpinned this issue Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant