CSC/ECE 517 Fall 2023 - E2369. Reimplement duties controller.rb and badges controller.rb

From Expertiza_Wiki
Revision as of 00:00, 31 October 2023 by Avarma4 (talk | contribs) (Created page with "== Topic Overview & Prior Work == === Background === '''duties_controller.rb''' The actions defined by this duties_controller include create, update, and remove. The new duty...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Topic Overview & Prior Work

Background

duties_controller.rb The actions defined by this duties_controller include create, update, and remove. The new duty is saved to the database using the create action. The update action is used to update the duty in the database, while the edit action renders the form for editing an existing duty. Lastly, a duty can be removed from the database by using the delete action. All things considered, Expertiza's Duties module aids in the management of duties.

badges_controller.rb A new Badge instance is created by the controller using the user-supplied parameters through the use of the create action. If an image file is attached, it additionally saves it and modifies the badge instance's image_name attribute.

Previous Work

One thing that the team should have kept in mind was that this is an API written on Rails, not a Rails MVC application. In the previous implementation of the duties and badges controllers, it was treated as a Rails MVC application whereas it's an API written on Rails. Requests and answers ought to be handled like API requests, with JSON data returned. Additionally, there wasn't enough testing performed in the previous implementation.

Topic Overview & Prior Work

Functions to implement

Functionalities for Duties

  • Creating and adding a new duty to the database
  • Editing an existing duty
  • Updating an existing duty

Functionalities for Badges

  • Creating a new badge upon the parameters passed
  • Saving an attached image file
  • Updating the image_name attribute of a badge