Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user dashboard [basic poet mgmt] #28

Closed
asmr-hex opened this issue Apr 26, 2018 · 0 comments
Closed

user dashboard [basic poet mgmt] #28

asmr-hex opened this issue Apr 26, 2018 · 0 comments
Labels
enhancement New feature or request
Projects

Comments

@asmr-hex
Copy link
Owner

asmr-hex commented Apr 26, 2018

Overview

implement basic poet management actions. this is contained within epic #30 .

User Actions

users should be able to perform the following actions on the dashboard,

  • upload poet
  • view poets

Acceptance Criteria

when then
a user logs in they are presented with a dashboard page
@asmr-hex asmr-hex created this issue from a note in dev (To do) Apr 26, 2018
asmr-hex pushed a commit that referenced this issue Apr 26, 2018
Major Changes:
* implement `session` reducer which includes login state and user
  state reducers
* pass react-router history to #requestLogin and #requestSignup
  s.t. if those actions are successful they can trigger a redirect to
  the user dashboard via `history.push(...)`
* connect Home component to `state.session.loggedIn`
* include Route for Dashboard

Notes:
* for some reason, the dashboard page isn't automatically redirected
  to. This is most likely due to my lack of unsertanding of the new
  React-Router API. i need to look into this.
* i should refactor the highest level component to be called `App` or
  something which is the controller for switching between the main
  pages of the app (e.g. Home, Dashboard, Issues, etc.)
asmr-hex pushed a commit that referenced this issue Apr 27, 2018
Major Changes:
* refactor component hierarchy s.t. Dashboard and Home are top-level
  sibling components within the App component (root component
  essentially)
* implement PoetMgmt component for managing a users poet
* implement UserMgmt component stub for managing user account
* implement CreatePoetForm component for uploading poets
* implement FileInput adapter function for allowing redux-form to
  support <input type='file'/>
* implement #requestCreatePoet, #createPoetSuccessful, and
  #createPoetFailed redux actions
* implement #poets reducer
* modify session.user reducer to normalize user.poets
* implement #getPoetsOfUser selector
* add server-side endpoint for dashboard poet creation @
  /dashboard/poet
* extensively comment #CreatePoet endpoint handler, including curl
  command to use
* fix error bugs in #CreatePoet
* write poet in response to create poet request
* implement poet.Sanitize
* implement db method for reading poets which have been designed by a
  particular user.
* update CreatePoet validation.
* attempt to include error messages returned from server in error
  thrown in checkResponse
* ensure that session_token cookie is sent on all subsequent requests
  after signup/login
* implement Dashboard page component for accessing account and poet
  management pages
* fix `react img alt` warnings in About component

Notes:
* while refactoring the component hierarchy, ran into friction with
  react-router API, namely on matching paths for routes wrapped in
  <Static> and also for components not getting updated for when the
  history is pushed to programmatically (e.g. we redirect once a redux
  action occurs). For the former, i realized that the order in which
  you specify routes matters because the path which matches first is
  chosen (so you should always put "/" last!). For the later, i found
  a quick solution (though apparently not the most efficient solution)
  which is to wrap my top level component (App) with the function
  #withRouter from the react-router-dom lib. See App component
  comments for details.
* another pain point i ran into was redux-form's lack of support out
  of the box for handling file inputs. i eventually had to implement
  an ugly looking adapter function

TODO:
* refactor FileInput adapter function
* include error message returned from server in error thrown in
  checkResponse. This is hard because to get the error from the server
  we need to call `response.text()` within #checkResponse, which
  itself returns a Promise. i need to figure out how to reject this
  promise from within this promise handler (#checkResponse). this is
  just due to my lack of familiarity with Promises i think.
* if a cookie is available on refresh or page load, try to immediately
  load the user data into the redux store.
* include a server-side constant of supported languages

            /|      __
           / |   ,-~ /
          Y :|  //  /
          | jj /( .^
          >-"~"-v"
         /       Y
        jo  o    |
       ( ~T~     j
        >._-' _./
       /   "~"  |
      Y     _,  |
     /| ;-"~ _  l
    / l/ ,-"~    \
    \//\/      .- \
     Y        /    Y
     l       I     !
     ]\      _\    /"\
    (" ~----( ~   Y.  )
~~~~~~~~~~~~~~~~~~~~~~~~~~
dev automation moved this from To do to Done Apr 27, 2018
@asmr-hex asmr-hex changed the title user dashboard user dashboard [basic poet mgmt] Apr 28, 2018
@asmr-hex asmr-hex mentioned this issue Apr 28, 2018
@asmr-hex asmr-hex added the enhancement New feature or request label Apr 28, 2018
asmr-hex pushed a commit that referenced this issue Apr 28, 2018
Major Changes:
* implement `session` reducer which includes login state and user
  state reducers
* pass react-router history to #requestLogin and #requestSignup
  s.t. if those actions are successful they can trigger a redirect to
  the user dashboard via `history.push(...)`
* connect Home component to `state.session.loggedIn`
* include Route for Dashboard

Notes:
* for some reason, the dashboard page isn't automatically redirected
  to. This is most likely due to my lack of unsertanding of the new
  React-Router API. i need to look into this.
* i should refactor the highest level component to be called `App` or
  something which is the controller for switching between the main
  pages of the app (e.g. Home, Dashboard, Issues, etc.)
asmr-hex pushed a commit that referenced this issue Apr 28, 2018
Major Changes:
* refactor component hierarchy s.t. Dashboard and Home are top-level
  sibling components within the App component (root component
  essentially)
* implement PoetMgmt component for managing a users poet
* implement UserMgmt component stub for managing user account
* implement CreatePoetForm component for uploading poets
* implement FileInput adapter function for allowing redux-form to
  support <input type='file'/>
* implement #requestCreatePoet, #createPoetSuccessful, and
  #createPoetFailed redux actions
* implement #poets reducer
* modify session.user reducer to normalize user.poets
* implement #getPoetsOfUser selector
* add server-side endpoint for dashboard poet creation @
  /dashboard/poet
* extensively comment #CreatePoet endpoint handler, including curl
  command to use
* fix error bugs in #CreatePoet
* write poet in response to create poet request
* implement poet.Sanitize
* implement db method for reading poets which have been designed by a
  particular user.
* update CreatePoet validation.
* attempt to include error messages returned from server in error
  thrown in checkResponse
* ensure that session_token cookie is sent on all subsequent requests
  after signup/login
* implement Dashboard page component for accessing account and poet
  management pages
* fix `react img alt` warnings in About component

Notes:
* while refactoring the component hierarchy, ran into friction with
  react-router API, namely on matching paths for routes wrapped in
  <Static> and also for components not getting updated for when the
  history is pushed to programmatically (e.g. we redirect once a redux
  action occurs). For the former, i realized that the order in which
  you specify routes matters because the path which matches first is
  chosen (so you should always put "/" last!). For the later, i found
  a quick solution (though apparently not the most efficient solution)
  which is to wrap my top level component (App) with the function
  #withRouter from the react-router-dom lib. See App component
  comments for details.
* another pain point i ran into was redux-form's lack of support out
  of the box for handling file inputs. i eventually had to implement
  an ugly looking adapter function

TODO:
* refactor FileInput adapter function
* include error message returned from server in error thrown in
  checkResponse. This is hard because to get the error from the server
  we need to call `response.text()` within #checkResponse, which
  itself returns a Promise. i need to figure out how to reject this
  promise from within this promise handler (#checkResponse). this is
  just due to my lack of familiarity with Promises i think.
* if a cookie is available on refresh or page load, try to immediately
  load the user data into the redux store.
* include a server-side constant of supported languages

            /|      __
           / |   ,-~ /
          Y :|  //  /
          | jj /( .^
          >-"~"-v"
         /       Y
        jo  o    |
       ( ~T~     j
        >._-' _./
       /   "~"  |
      Y     _,  |
     /| ;-"~ _  l
    / l/ ,-"~    \
    \//\/      .- \
     Y        /    Y
     l       I     !
     ]\      _\    /"\
    (" ~----( ~   Y.  )
~~~~~~~~~~~~~~~~~~~~~~~~~~
asmr-hex pushed a commit that referenced this issue Sep 11, 2018
* [cw|#2] refactor src tree to separate server/client code, add travis.yml,
include single placeholder golang test.

* [cw|#2] init react app client with create-react-app, update
.travis.yml, update.gitignore

* [cw|#2] fix .travis.yml to move into appropriate directories

* [cw|#2] omg, debugging travis

* [cw|#2] set client/node_modules/.bin to PATH env var

* [cw|#2] q_q

* [cw|#2] include travis build badge

* [cw|#4] create api router, stub route handlers

* [cw|#4] refactor platform to include api

* [cw|#4] include path parameter checking, add validation middleware +
tests, stub authorization middleware

* [cw|#4] vendor external deps

* [cw|#4] fix middleware to include NextMiddleware, add Postgres
configuration
TODO: setup Postgres in Travis env
TODO: write configuration script for Postgres
TODO: include said configuration script in dockerized dev env

* [cw|#7] setup dockerized dev/prod application, setup golang fs watcher
for dev env, customize docker-compose for prod and dev, customize
dockerfiles for prod and dev

* [cw|#7] setup database connection with server

* [cw|#7] clean up docker-compose script to use env_file and env vars in config

* [cw|#7] switch libs we are using to read in ENV_VARS, add logging
utils, refactor where http listener resides => Platform.Start()

* [cw|#7] add silly comment

* [cw|#7] inject db connection into API struct, refactor api constants,
add comments for things todo

* [cw|#7] write nifty logger utils -__-, begin writing sql statements
for individual data types, write convenient shell script for running
server and client tests within their docker containers while dev env
is running.

* [cw|#7] setup rough framework for unit tests against test db,
refactored model slightly (moved away from a list of poets in user and
rather chose to have poets have writers (or gods lol)), setup script
for creating a test db by extending the postgres Docker image. All
this needs to be cleaned up and the tests will not work in travis yet.

* [cw|#7] refactor types/tests to use testify/suite framework s.t. we
have an organized way of sharing global datastructures, setting up,
tearing down suites/tests. update dev server docker image to install
connorwalsh/gotest to print colorful test output, update env/config to
contain a test config. This is somewhat hacky since it is essentially
duplicating code, but it works for now.

* [cw|#7] refactor creating test db, include DEV_ENV env var, create dir
for small postgres Dockerfile extension

* [cw|#7] dockerize travis tests to run tests within dev env, this way
tests are run in a more similar environment to prod

* [cw|#7] here we go again.. debugging the travis build -___-

* [cw|#7] clean .travis.yml script, not tests are running in dev
environment in travis :)

* [cw|#7] update README, remove old travis conf

* [cw|#7] update README

* [cw] pass DEV_ENV env var into dev server container, refactor api to
have access to config for detecting if we are in DEV_ENV, serve static
page only in production

* [cw,am|#9] extract uuid validation into separate utils package, fix
postgres sql parameter syntax (positional arguments), begin writing
user validation on a per action basis, include test fore user create

* [cw|#9] add more cases to user validation, test user Read and Delete,
begin working on user update (which might be tricky because we need to
be able to detect provided fields)

* [cw|#9] complete ReadAllUsers and include test

* [cw|#11] begin working on poet crud

* [cw|#11] add json tags to poet struct, implement create and read,
include basic test coverage

* [cw|#11] implement read all poets

* [cw|#11] add comment w.r.t. deletes

* [cw,am|#14] create volumes within prod/dev Dockerfiles for persisting
poet files on host fs, included sample data dir with sample
program/parameters files, added constants for file upload API, filled
in the body of CreatPoet in API handlers, created Users and Poets
Tables on Platform setup, added Language field/column to Poets data
model

TODOS:
* need to return HTTP responses to users in CreatePoet handler
* need to write unit tests for Creat Poet handler
* Must implement User creation/auth/session stuff (idk???) in order to
  properly create a poet (since the poets table in Postgres references
  UUIDs within the users table)
* possibly refactor the id arg in poet.Create.

* [cw,am|#14] update poet tests to include Language field

* [cw,am|#14] implemented user registration, login/auth, introduced
in-memory session token cache, modified user table to include hashed
password and salt, implement session methods for correlating userIds
to session tokens and vice versa

❀‿❀ -- yay!!

(づ。◕‿‿◕。)づ -- wheeeeee

╰(◡‿◡✿╰) -- whoooooo

TODOS:
* use CookieJar instead of Cookie?
* standardize form vs. data for requests
* implement session token expiration policy goroutine
* actually send responses to clients (send session token cookie as
  well)
* write unit test for all of this ;___;

* [cw,am|#14] implement http & token sweeper

Major Changes:
* add http responses for login, register, and create poet
* send session token in login response
* implemement session token background sweeper

Notes:
* tests are currently broken (1 server test)
* token timeout duration is hard-coded, move to config

( ˘ ³˘)♥ ( ˘ ³˘)♥ ( ˘ ³˘)♥ ( ˘ ³˘)♥ ( ˘ ³˘)♥

* [cw|#14] implement GetUsers and GetPoets endpoint

* [cw|#14] poet validation
Major Changes:
* add create, read, update, delete validation for poets
* implement name regexp validator (supports unicode)
* unit tests for name regexp validator

TODO:
* validate that poet can only be created/modified/deleted by designer
* test coverage for poet validator function

* [cw|#14] add username and email validation

* [#15] start implementing client home page

Co-authored-by: Victor <vcabre4@gmail.com>

* [cw|#15] begin designing home page interactivity

* [cw|#15] implement beginning of home page menu

* [cw|#15] introduce redux and react-router. still debugging.

* [cw|#15] add dependencies to package.json

* [cw|#15] setup react-redux connect

* [cw|#15] refactor home page components

TODO: figure out css gradient animations

* [cw|#15] comment out client test

TODO: figure out how to wrap tests in redux Provider

* [cw|#25] create routes to about, home, login

NOTE: possibly found a bug in react-router (see comment at the end of /client/src/components/home/index.js)

* [cw|#25] finish about page layout

* [cw|#25] fill in about pages

* begin loginpage

* working on redux forms

* setup unplugged form components

Major Changes:
* add top level form reducer to redux
* create login & signup form components
* create parent component to toggle between login/signup

Todos:
* form validation (client-side)
* clean up ui (use material ui)

* hook up login to backend with fetch (wip)

Major Changes:
* HARD-CODE package.json 'proxy' field to be dev_server docker
  host+port
  * note that this has to be done since there is no way we can set the
  proxy other than within package.json rn (we need to do this to avoid
  CORS issues in the dev environment)
* setup async fetch actions

* update login handler to support Content-Type: application/json

Major Changes:
* start enforcing uniform api style. namely, json encoded data for all
  POSTS except for file uploads which will be multipart-form

* implement basic signup/login

Major Changes:
* refactor API handlers
  * expose #Login handler to only deal with validation/auth
  * delegate #login to deal with session tokens and updating login state
  * leave breadcrumbs for refactoring #CreateUser once we have #VerifyAccount
* re-structure dashboard endpoints `/api/dashboard/...` -> `/dashboard/...`
* add `/verify` endpoint for future
* include #VerifyAccount stub func for handling email verification in
  the future
* refactor client code to handle login/signup responses correctly

* refactor response checking and error handling on client

Major Changes:
* rename #handleErrors -> #checkResponse
* mv #checkResponse to `action/error.js`
* adjusted #checkResponse to print error with stacktrace
* introduce global error message reducer
  * this reducer will set the global error message whenever *any*
  action includes an `error` field
* introduce #resetErrorMsg action for clearing the global redux error
  message
* add error prefixes for #loginFailed and #signupFailed
* add #Sanatize method to Users struct server-side for clearing password

* [#28] include user session state and redirection upon login

Major Changes:
* implement `session` reducer which includes login state and user
  state reducers
* pass react-router history to #requestLogin and #requestSignup
  s.t. if those actions are successful they can trigger a redirect to
  the user dashboard via `history.push(...)`
* connect Home component to `state.session.loggedIn`
* include Route for Dashboard

Notes:
* for some reason, the dashboard page isn't automatically redirected
  to. This is most likely due to my lack of unsertanding of the new
  React-Router API. i need to look into this.
* i should refactor the highest level component to be called `App` or
  something which is the controller for switching between the main
  pages of the app (e.g. Home, Dashboard, Issues, etc.)

* [#28] poet upload from webpage

Major Changes:
* refactor component hierarchy s.t. Dashboard and Home are top-level
  sibling components within the App component (root component
  essentially)
* implement PoetMgmt component for managing a users poet
* implement UserMgmt component stub for managing user account
* implement CreatePoetForm component for uploading poets
* implement FileInput adapter function for allowing redux-form to
  support <input type='file'/>
* implement #requestCreatePoet, #createPoetSuccessful, and
  #createPoetFailed redux actions
* implement #poets reducer
* modify session.user reducer to normalize user.poets
* implement #getPoetsOfUser selector
* add server-side endpoint for dashboard poet creation @
  /dashboard/poet
* extensively comment #CreatePoet endpoint handler, including curl
  command to use
* fix error bugs in #CreatePoet
* write poet in response to create poet request
* implement poet.Sanitize
* implement db method for reading poets which have been designed by a
  particular user.
* update CreatePoet validation.
* attempt to include error messages returned from server in error
  thrown in checkResponse
* ensure that session_token cookie is sent on all subsequent requests
  after signup/login
* implement Dashboard page component for accessing account and poet
  management pages
* fix `react img alt` warnings in About component

Notes:
* while refactoring the component hierarchy, ran into friction with
  react-router API, namely on matching paths for routes wrapped in
  <Static> and also for components not getting updated for when the
  history is pushed to programmatically (e.g. we redirect once a redux
  action occurs). For the former, i realized that the order in which
  you specify routes matters because the path which matches first is
  chosen (so you should always put "/" last!). For the later, i found
  a quick solution (though apparently not the most efficient solution)
  which is to wrap my top level component (App) with the function
  #withRouter from the react-router-dom lib. See App component
  comments for details.
* another pain point i ran into was redux-form's lack of support out
  of the box for handling file inputs. i eventually had to implement
  an ugly looking adapter function

TODO:
* refactor FileInput adapter function
* include error message returned from server in error thrown in
  checkResponse. This is hard because to get the error from the server
  we need to call `response.text()` within #checkResponse, which
  itself returns a Promise. i need to figure out how to reject this
  promise from within this promise handler (#checkResponse). this is
  just due to my lack of familiarity with Promises i think.
* if a cookie is available on refresh or page load, try to immediately
  load the user data into the redux store.
* include a server-side constant of supported languages

            /|      __
           / |   ,-~ /
          Y :|  //  /
          | jj /( .^
          >-"~"-v"
         /       Y
        jo  o    |
       ( ~T~     j
        >._-' _./
       /   "~"  |
      Y     _,  |
     /| ;-"~ _  l
    / l/ ,-"~    \
    \//\/      .- \
     Y        /    Y
     l       I     !
     ]\      _\    /"\
    (" ~----( ~   Y.  )
~~~~~~~~~~~~~~~~~~~~~~~~~~

* Deploy (#31)

* [cw|#20] submission scheduler skeleton

Major Changes:
* create `Submissions` struct
* initialize `Submission` instance in `Platform`
* start `Submissions` scheduler in `Platform.Start()`
* outline skeletons for `Submissions` methods

* [cw|#20] scaffold SubmissionsService struct

Major Changes
* introduce SubmissionService struct to embrace eternity & open call
  for submissions (forever)

* [cw] integrate xaqt and implement generate `poet.GeneratePoem()`

* [cw] write more about testing submitted poets

* modify sample poet

* setup continuous development
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
dev
  
Done
Development

No branches or pull requests

1 participant