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

Jk mar4 #17

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -240,3 +240,7 @@ ModelManifest.xml

# FAKE - F# Make
.fake/

FakeTrelloERD.jpg.vpp
FakeTrelloERD.jpg.vpp.bak_000d
FakeTrelloERD.jpg.vpp.bak_001f
Binary file added FakeTrello.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions FakeTrello/DAL/FakeTrelloContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using FakeTrello.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FakeTrello.DAL
{
public class FakeTrelloContext : ApplicationDbContext
{
}
}
5 changes: 5 additions & 0 deletions FakeTrello/FakeTrello.csproj
Original file line number Diff line number Diff line change
@@ -180,12 +180,17 @@
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ManageController.cs" />
<Compile Include="DAL\FakeTrelloContext.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\AccountViewModels.cs" />
<Compile Include="Models\Board.cs" />
<Compile Include="Models\Card.cs" />
<Compile Include="Models\IdentityModels.cs" />
<Compile Include="Models\List.cs" />
<Compile Include="Models\ManageViewModels.cs" />
<Compile Include="Models\TrelloUser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" />
</ItemGroup>
25 changes: 25 additions & 0 deletions FakeTrello/Models/Board.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace FakeTrello.Models
{
public class Board
{
[Key]
public int BoardId { get; set; }

[MaxLength(50)]
public string BoardName { get; set; }

[MaxLength(50)]
public string URL { get; set; }

// Auxiliary = not required to drive/define relationship
public TrelloUser Owner { get; set; }

public List<List> Lists { get; set; }
}
}
21 changes: 21 additions & 0 deletions FakeTrello/Models/Card.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace FakeTrello.Models
{
public class Card
{
[Key]
public int CardId { get; set; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explore how you would link a user (owner) or users (contributors or people who have been tagged) to a Card. You've got all the classes you need already, so think about how you would add those links with new properties in your Card class.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katerebekah Would it be something like this?

public TrelloUser Contributer { get; set; }
public TrelloUser Owner { get; set; }


public string Title { get; set; }

public string Description { get; set; }

//Auxilliary: given a card instance, return the list it belongs to.
public List BelongsTo { get; set; }
}
}
22 changes: 22 additions & 0 deletions FakeTrello/Models/List.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace FakeTrello.Models
{
public class List
{
[Key]
public int ListId { get; set; }

[MaxLength(50)]
public string ListName { get; set; }

//does this need to be added?
public Board BelongsToBoard { get; set; }

public List<Card> Cards { get; set; }
}
}
39 changes: 39 additions & 0 deletions FakeTrello/Models/TrelloUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

//Entity is our Object Relational Mapper (ORM) So it knows how to interpret this information

namespace FakeTrello.Models
{
public class TrelloUser
{
[Key] //help tell db system what constraints to take, applies to first property it hits going down
public int TrelloUserId { get; set; } //Primary Key

//stacking of properties applies multiple annotations
//to the following property. failed = database failed constraint
[MinLength(10)]
[MaxLength(50)]
public string Email { get; set; }

[MaxLength(50)]
public string Username { get; set; }

[MaxLength(50)]
public string Password { get; set; }

[MaxLength(50)]
public string FirstName { get; set; }

[MaxLength(50)]
public string LastName { get; set; }

public ApplicationUser BaseUser { get; set; } // creates one to one relationship to another table

public List<Board> Boards { get; set; } // 1 to many (boards) relationship. Navigation property. Does join sql statement for you. Entity knows how to interpret that relationship.

}
}
Binary file added FakeTrelloERD.jpg.vpp
Binary file not shown.
Binary file added FakeTrelloERD.jpg.vpp.bak_000d
Binary file not shown.
Binary file added FakeTrelloERD.jpg.vpp.bak_001f
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -17,4 +17,4 @@

### Fake Trello ERD

[ERD goes here]
![Fake Trello Picture](/FakeTrello.jpg?raw=true)