Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

An authenticated user can post a question #25

Closed
josepostiga opened this issue Oct 3, 2020 · 4 comments · Fixed by #40
Closed

An authenticated user can post a question #25

josepostiga opened this issue Oct 3, 2020 · 4 comments · Fixed by #40
Assignees
Labels
story New feature

Comments

@josepostiga
Copy link
Member

josepostiga commented Oct 3, 2020

Scenario

Given I'm an authenticated user of any type
When I send a POST request to /discussions/questions with the required input
I expect that question to be stored

Description

One of the main objectives of the Laravel-Portugal community is to help our fellow developers overcome their difficulties and have their doubts answered by other developers. This type of interaction has been supported by the normal operations of our Discord server, which has specific channels where registered members can post questions and start discussing them.

However, when many developers start to submit any questions, at the same time, the conversation gets to an unbearable and unmanageable point that to avoid such a mess, many people start to move the discussion to private chats and won't benefit other devs with the same doubts because it's unsearchable.

Since we're developing a new portal, and we've planned to introduce users' accounts, it's time to start adding the possibility to concentrate all questions, and the knowledge shared while resolving them, in a publicly available place. It's also a good way to focus the Discord server to only be a place of synchronous, real-time, conversations.

Database and schema information

A new questions table should be created with the following structure:

  • id: PK.
  • author_id: FK, related to the user who created the question. Must be required and indexed.
  • title: the title of the question. Must be required and indexed.
  • slug: the URL friendly identifier, automatically generated based on the title.
  • description: the question itself. Must be required.
  • created_at: timestamp with timezone. Must be indexed and default to the date the resource is created.
  • updated_at: timestamp with timezone. Must be indexed.
  • deleted_at: timestamp with timezone. Must be indexed and default to null. This indicates if the resource was deleted.
  • resolved_at: timestamp with timezone. Must be indexed and default to null. This indicates that the question as resolved.

Additional requirements

This builds on the features of #22, which introduces users' accounts.

@tiagof
Copy link
Collaborator

tiagof commented Oct 12, 2020

Hi @josepostiga I'l pick this one.
Draft PR #40

@josepostiga
Copy link
Member Author

@tiagof as discussed on our Discord server, I've updated the proposed database table schema.

tiagof added a commit to tiagof/api that referenced this issue Oct 12, 2020
resolves laravel-portugal#25
Removes unnecessary code in AccountsStoreController.
@tiagof
Copy link
Collaborator

tiagof commented Oct 12, 2020

PR is ready for review.
Please note that the routes "style" doesn't match what you recently applied in Account with this commit - i.e., defining the prefix in the XXXServiceProvider.

To keep the same logic we should change the requirement and move the endpoint /questions to /discussions/questions having discussions as prefix for all the routes from this domain.
Let me know if I should change it.

@josepostiga
Copy link
Member Author

@tiagof that proposal, of adding the /discussions prefix, looks really good to me. In fact I think we can encapsulate the questions domain inside a new discussions domain.

tiagof added a commit to tiagof/api that referenced this issue Oct 16, 2020
tiagof added a commit that referenced this issue Oct 17, 2020
* init

* Adds Question create feature

resolves #25
Removes unnecessary code in AccountsStoreController.

* Added '/discussions' prefix

As per #25 (comment)

* Minor fixes as per review

#40 (review)

* Cleanup
tiagof added a commit to tiagof/api that referenced this issue Oct 17, 2020
…ion (laravel-portugal#40)

* init

* Adds Question create feature

resolves laravel-portugal#25
Removes unnecessary code in AccountsStoreController.

* Added '/discussions' prefix

As per laravel-portugal#25 (comment)

* Minor fixes as per review

laravel-portugal#40 (review)

* Cleanup
josepostiga pushed a commit that referenced this issue Oct 24, 2020
* init

* Adds Question create feature

resolves #25
Removes unnecessary code in AccountsStoreController.

* init

* done

* init

* done

Rebased on top of feature/issue-25 since we need the AuthServiceProvider to be enabled.

* Fix

Remove migration 'down' function, otherwise we'd need to add doctrine/dbal dependency.
Fixed exception if no user is authenticated.

* Update from upstream

* Move link limit validation to Policy.

Other minor tweaks

* Added Link limit tests for trusted and Editor users

* Update CHANGELOG.md

* refactor(Links): pushed policy execution to after input validation and minor code style cleanup

Co-authored-by: José Postiga <[email protected]>
josepostiga pushed a commit that referenced this issue Oct 25, 2020
* init

* Adds Question create feature

resolves #25
Removes unnecessary code in AccountsStoreController.

* Added '/discussions' prefix

As per #25 (comment)

* Minor fixes as per review

#40 (review)

* Cleanup

* Added question update

* Added tests

* Resolves #28, #29: "Update timestamps columns on links and tags tables" (#38)

* feat(Tags): add support to timestamps w/timezones

- drop regular timestamps columns
- create new ones with timestampsTz

* feat(Links): add support to timestamps w/timezones

added doctrine/dbal dependency

* fix: add method return type

* fix(Links): add missing timestamp (approved_at)

* chore: converted timestampTz to softDeletesTz

* feat(links): added approved_at datetime cast

* fix: replaced dropColumn with change method

* chore(Changelog): add latest updates

timestamps columns (on links and tags) changed to datetime w/timezone

* Resolves #25 - An authenticated user can post a question (#40)

* init

* Adds Question create feature

resolves #25
Removes unnecessary code in AccountsStoreController.

* Added '/discussions' prefix

As per #25 (comment)

* Minor fixes as per review

#40 (review)

* Cleanup

* Resolve conflicts + test tweaks

* Code cleanup + minor improvements

* minor tweaks

* final tweaks/cleanup

* style(Discussions): minor code style fixes

* ci(PHPUnit): add blade files to the code coverage exclusion list

Co-authored-by: Alexandre Reis <[email protected]>
Co-authored-by: José Postiga <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
story New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants