DMIT-2018 / 2018-sep-2022-a01-workbook-jthompsonnait

2018-sep-2022-a01-workbook-jthompsonnait created by GitHub Classroom
2 stars 2 forks source link

General Planning Implementation tasks of Managing Play Lists in Chinook #4

Open jthompsonnait opened 2 years ago

jthompsonnait commented 2 years ago

This task list area will be completed once the implementation plan has been outlined. This area is where one creates the task list that is associated with the milestone. The tasks that are outlined in this area, are the tasks that are counted for the milestone.

jthompsonnait commented 2 years ago

UI Experience

This comment outlines the actions that can happen on the forms. Actions are in response to the user interacting with the form, pressing buttons or controls

PRG Post Redirect Get


Managing the playlist.

PLayList Management screen shot (1)

jthompsonnait commented 2 years ago

Data Models

The data models are the C# classes that will be coded in the folder (ViewModels) that holds the data classes in our solution. These classes represent the query class models and the command class models (CQRS).

Query_vs_Command_Data_Models


Query Models

Artist and Album Tracks fetch

Query_TrackInfo

public class TrackSelection
{
    public int TrackId {get; set;}
    public string SongName {get; set;}
    public string AlbumTitle {get; set;}
    public string ArtistName {get; set;}
    public int Milliseconds {get; set;}
    public decimal Price {get; set;
}

Current Playlist Tracks

Query_PLTrackes

public class PlaylistTrackInfo
{
    public int TrackId {get; set;}
    public int TrackNumber {get; set;}
    public string SongName {get; set;}
    public int Milliseconds {get; set;}
}

Command Models

Add Track

Add_Track

No model class, individual parameters

Remove Tracks

RemoveTracks

UserName and PlaylistName are individual parameters. Requires track id list in a List

Move Trakcs (re-sequence playlist))

MoveTracks

public class PlaylistTrackMove
{
     public int TrackId {get; set;}
     public bool SelectedTrack {get; set;}
     public int TrackNumber {get; set;}
     public int TrackInput {get; set; }
}
jthompsonnait commented 2 years ago

Business Processing Requirements

This comment will describe the various methods that will be used for Commands (CQRS) that alter the database. Queries are read only and require on average no complex processing. However, commands require business rule validations and manipulations of one or more tables and/or records. Therefore, the processing of commands should be outlined.

include the method signature and a bullet list of processes

Add Track

void PlaylistTrack_AddTrack(string playlistname, string username, int trackid)

  • check track exists (trackid)
  • no

    add exception

  • check playlist exists (playlistname, username)
  • yes (playlist there)
    • check track is not already on playlist
      • yes
        • add exception
      • no
        • generate next track number
      • no (new playlist)
        • create a new playlist record
        • set track number to 1
        • add track to playlist tracks
  • check for any errors
  • yes
    • throw list of all collected exceptions
  • no
    • save all work to database

      Remove Tracks

      void PlayListTrack_RemoveTracks(string playlistname, string username, List <PlaylistTrackMove> trackstoremove)

  • Check playlist exists
  • no
    • add exception
  • yes
    • obtain a list of tracks to retain (order by tracknumber0
    • for each track to remove, remove track
    • for each track to retain
    • re-sequence list of tracks to retain starting at one
    • stage update
  • check for any exceptions
  • yes
    • throw new exception with list
  • no
    • save staged work to database

      Move Tracks

      void PlayListTrack_MoveTracks(string playlistname, string username, List <PlayLlstTrackMove> trackstomove)

  • check playlist exists
  • no
    • add exception
  • yes
    • check trackstomove sequence
    • order by tracknumber
    • for each track:
      • tracknumber is positive numeric (add any exception)
      • tracknumber is unique (add any exception)
    • for each track:
      • re-sequence tracknumber (start 1, increment by 1)
      • stage update
  • check for any exceptions
  • yes
    • throw new exception with list
  • no
    • save staged work to database