Skip to content

WIP: Persisted issue board filters BE

Oswaldo Ferreir requested to merge 2518-persisted-issue-boards-filter-be into master

What does this MR do?

Implement the backend for persisted issue boards.

Are there points in the code the reviewer needs to double check?

Roadmap

Group issue board

  • Create tables
  • Create model relationships
  • Groups::BoardsController#create should be able to receive filter params (and work for board name)

Current request:

Started POST "/groups/test/boards.json" for 127.0.0.1 at 2017-09-20 17:18:23 -0300 Processing by Groups::BoardsController#create as JSON Parameters: {"id"=>false, "name"=>"group board", "milestone"=>{"id"=>nil, "title"=>"Any Milestone"}, "milestone_id"=>nil, "group_id"=>"test", "board"=>{"id"=>false, "name"=>"group board", "milestone_id"=>nil}}


- [ ] FE should be able to fetch each fields data (check existing endpoints)

- [x] `Groups::BoardsController#update` should be able to receive filter params (and work for board `name`)

> Current request:

> ```
Started PUT "/groups/test/boards/5.json" for 127.0.0.1 at 2017-09-20 18:08:31 -0300
Processing by Groups::BoardsController#update as JSON
  Parameters: {"id"=>"5", "name"=>"group board", "milestone_id"=>nil, "group_id"=>"test", "board"=>{"id"=>"5", "name"=>"group board", "milestone_id"=>nil}}
  • Groups::BoardsController#index should be able to use the persisted filters to actually filter
  • Return the data needed to build the Edit board on controllers show action

Projects issue board

  • Projects::BoardsController#update should be able to receive filter params (and keep working for board name)

Current request:

Started PUT "/groups/test/boards/5.json" for 127.0.0.1 at 2017-09-20 17:25:28 -0300
  GeoNode Exists (0.4ms)  SELECT  1 AS one FROM "geo_nodes" LIMIT 1
Processing by Groups::BoardsController#update as JSON
  Parameters: {"id"=>"5", "name"=>"group boar", "milestone_id"=>nil, "group_id"=>"test", "board"=>{"id"=>"5", "name"=>"group boar", "milestone_id"=>nil}}

Endpoints to use

  • http://localhost:3001/a-group/x/milestones.json
  • http://localhost:3001/a-group/x/labels.json
  • http://localhost:3001/autocomplete/users.json?search=&per_page=20&active=true&project_id=28&group_id=x

Migrations

db:migrate

== 20170926200545 AddBoardFilterFields: migrating =============================
-- add_column(:boards, :weight, :integer, {:index=>true})
   -> 0.0015s
-- add_reference(:boards, :author, {:index=>true})
   -> 0.0064s
-- add_reference(:boards, :assignee, {:index=>true})
   -> 0.0048s
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- execute("ALTER TABLE boards\nADD CONSTRAINT fk_58e8fc64f3\nFOREIGN KEY (author_id)\nREFERENCES users (id)\nON DELETE SET NULL\nNOT VALID;\n")
   -> 0.0030s
-- execute("ALTER TABLE boards VALIDATE CONSTRAINT fk_58e8fc64f3;")
   -> 0.0027s
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0004s
-- execute("ALTER TABLE boards\nADD CONSTRAINT fk_2a3450e77c\nFOREIGN KEY (assignee_id)\nREFERENCES users (id)\nON DELETE SET NULL\nNOT VALID;\n")
   -> 0.0025s
-- execute("ALTER TABLE boards VALIDATE CONSTRAINT fk_2a3450e77c;")
   -> 0.0020s
== 20170926200545 AddBoardFilterFields: migrated (0.0255s) ====================

== 20170926202731 AddMilestoneForeignKeyToBoards: migrating ===================
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- execute("ALTER TABLE boards\nADD CONSTRAINT fk_b93160e8ee\nFOREIGN KEY (milestone_id)\nREFERENCES milestones (id)\nON DELETE SET NULL\nNOT VALID;\n")
   -> 0.0015s
-- execute("ALTER TABLE boards VALIDATE CONSTRAINT fk_b93160e8ee;")
   -> 0.0022s
== 20170926202731 AddMilestoneForeignKeyToBoards: migrated (0.0047s) ==========

== 20170926203418 CreateBoardFilterLabels: migrating ==========================
-- create_table(:board_filter_labels)
   -> 0.0130s
-- add_index(:board_filter_labels, [:board_id, :label_id], {:unique=>true})
   -> 0.0039s
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0004s
-- execute("ALTER TABLE board_filter_labels\nADD CONSTRAINT fk_53e44f3a07\nFOREIGN KEY (board_id)\nREFERENCES boards (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0019s
-- execute("ALTER TABLE board_filter_labels VALIDATE CONSTRAINT fk_53e44f3a07;")
   -> 0.0044s
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- execute("ALTER TABLE board_filter_labels\nADD CONSTRAINT fk_91e18fdcee\nFOREIGN KEY (label_id)\nREFERENCES labels (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0015s
-- execute("ALTER TABLE board_filter_labels VALIDATE CONSTRAINT fk_91e18fdcee;")
   -> 0.0019s
== 20170926203418 CreateBoardFilterLabels: migrated (0.0295s) =================

db:rollback STEP=3

== 20170926203418 CreateBoardFilterLabels: reverting ==========================
-- drop_table(:board_filter_labels)
   -> 0.0051s
== 20170926203418 CreateBoardFilterLabels: reverted (0.0054s) =================

== 20170926202731 AddMilestoneForeignKeyToBoards: reverting ===================
-- remove_foreign_key(:boards, {:column=>:milestone_id})
   -> 0.0070s
== 20170926202731 AddMilestoneForeignKeyToBoards: reverted (0.0071s) ==========

== 20170926200545 AddBoardFilterFields: reverting =============================
-- remove_column(:boards, :weight)
   -> 0.0012s
-- remove_foreign_key(:boards, {:column=>:author_id})
   -> 0.0059s
-- remove_reference(:boards, :author)
   -> 0.0018s
-- remove_foreign_key(:boards, {:column=>:assignee_id})
   -> 0.0056s
-- remove_reference(:boards, :assignee)
   -> 0.0013s
== 20170926200545 AddBoardFilterFields: reverted (0.0165s) ====================

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #2518 (closed)

Edited by Oswaldo Ferreir

Merge request reports

Loading