Anul 3 Semestrul 1
This commit is contained in:
@@ -0,0 +1,231 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = false
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false
|
||||
dotnet_style_qualification_for_property = false
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_collection_initializer = true
|
||||
dotnet_style_explicit_tuple_names = true
|
||||
dotnet_style_namespace_match_folder = true
|
||||
dotnet_style_null_propagation = true
|
||||
dotnet_style_object_initializer = true
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true
|
||||
dotnet_style_prefer_collection_expression = when_types_loosely_match
|
||||
dotnet_style_prefer_compound_assignment = true
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true
|
||||
dotnet_style_prefer_conditional_expression_over_return = true
|
||||
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true
|
||||
dotnet_style_prefer_inferred_tuple_names = true
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:silent
|
||||
|
||||
# Suppression preferences
|
||||
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||
|
||||
# New line preferences
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = true
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = false
|
||||
csharp_style_var_for_built_in_types = false
|
||||
csharp_style_var_when_type_is_apparent = false
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = true
|
||||
csharp_style_expression_bodied_constructors = false
|
||||
csharp_style_expression_bodied_indexers = true
|
||||
csharp_style_expression_bodied_lambdas = true
|
||||
csharp_style_expression_bodied_local_functions = false
|
||||
csharp_style_expression_bodied_methods = false
|
||||
csharp_style_expression_bodied_operators = false
|
||||
csharp_style_expression_bodied_properties = true
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||
csharp_style_prefer_extended_property_pattern = true
|
||||
csharp_style_prefer_not_pattern = true
|
||||
csharp_style_prefer_pattern_matching = true
|
||||
csharp_style_prefer_switch_expression = true
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
|
||||
csharp_style_prefer_readonly_struct = true
|
||||
csharp_style_prefer_readonly_struct_member = true
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true
|
||||
csharp_prefer_simple_using_statement = true
|
||||
csharp_style_namespace_declarations = block_scoped
|
||||
csharp_style_prefer_method_group_conversion = true
|
||||
csharp_style_prefer_primary_constructors = true
|
||||
csharp_style_prefer_top_level_statements = true
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true
|
||||
csharp_style_deconstructed_variable_declaration = true
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
||||
csharp_style_inlined_variable_declaration = true
|
||||
csharp_style_prefer_index_operator = true
|
||||
csharp_style_prefer_local_over_anonymous_function = true
|
||||
csharp_style_prefer_null_check_over_type_check = true
|
||||
csharp_style_prefer_range_operator = true
|
||||
csharp_style_prefer_tuple_swap = true
|
||||
csharp_style_prefer_utf8_string_literals = true
|
||||
csharp_style_throw_expression = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
|
||||
# New line preferences
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
|
||||
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
@@ -0,0 +1,196 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.Context;
|
||||
|
||||
public partial class JyrosContext : DbContext
|
||||
{
|
||||
public JyrosContext()
|
||||
{
|
||||
}
|
||||
|
||||
public JyrosContext(DbContextOptions<JyrosContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public required virtual DbSet<Sprint> Sprints { get; set; }
|
||||
|
||||
public required virtual DbSet<Story> Stories { get; set; }
|
||||
|
||||
|
||||
public required virtual DbSet<Team> Teams { get; set; }
|
||||
|
||||
public required virtual DbSet<User> Users { get; set; }
|
||||
|
||||
public required virtual DbSet<TeamMemberAvailability> TeamMemberAvailabilities { get; set; }
|
||||
|
||||
public required virtual DbSet<Adjustment> Adjustments { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Sprint>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.SprintId).HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
entity.Property(e => e.SprintId).HasColumnName("sprint_id");
|
||||
entity.Property(e => e.EndDate).HasColumnName("end_date");
|
||||
entity.Property(e => e.Goal)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("goal");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("name");
|
||||
entity.Property(e => e.StartDate).HasColumnName("start_date");
|
||||
entity.Property(e => e.Status)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
entity.Property(e => e.TeamId).HasColumnName("team_id");
|
||||
|
||||
entity.HasOne(d => d.Team).WithMany(p => p.Sprints)
|
||||
.HasForeignKey(d => d.TeamId)
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Story>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.StoryId).HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
entity.Property(e => e.StoryId).HasColumnName("story_id");
|
||||
entity.Property(e => e.CreatedBy).HasColumnName("created_by");
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("description");
|
||||
entity.Property(e => e.ParentId).HasColumnName("parent_id");
|
||||
entity.Property(e => e.SprintId).HasColumnName("sprint_id");
|
||||
entity.Property(e => e.Status)
|
||||
.HasMaxLength(15)
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
entity.Property(e => e.Priority).HasDefaultValue(1).HasColumnName("priority");
|
||||
entity.Property(e => e.StoryPoints).HasColumnName("story_points");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("title");
|
||||
|
||||
entity.HasOne(d => d.CreatedByNavigation).WithMany(p => p.Stories)
|
||||
.HasForeignKey(d => d.CreatedBy)
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
entity.HasOne(d => d.Parent).WithMany(p => p.InverseParent)
|
||||
.HasForeignKey(d => d.ParentId)
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
entity.HasOne(d => d.Sprint).WithMany(p => p.Stories)
|
||||
.HasForeignKey(d => d.SprintId)
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
entity.HasMany(d => d.Users).WithMany(p => p.StoriesNavigation)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"UsersStory",
|
||||
r => r.HasOne<User>().WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC"),
|
||||
l => l.HasOne<Story>().WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("StoryId", "UserId").HasName("PK__UsersSto__8DA87F2683494916");
|
||||
j.ToTable("UsersStories");
|
||||
j.IndexerProperty<int>("StoryId").HasColumnName("story_id");
|
||||
j.IndexerProperty<int>("UserId").HasColumnName("user_id");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Team>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.TeamId).HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
entity.HasIndex(e => e.TeamName, "UQ__Teams__29E35E0C9F1894C7").IsUnique();
|
||||
|
||||
entity.Property(e => e.TeamId).HasColumnName("team_id");
|
||||
entity.Property(e => e.TeamDescription)
|
||||
.HasMaxLength(500)
|
||||
.HasColumnName("team_description");
|
||||
entity.Property(e => e.TeamLeadId).HasColumnName("team_lead_id");
|
||||
entity.Property(e => e.TeamName)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("team_name");
|
||||
|
||||
entity.HasOne(d => d.TeamLead).WithMany(p => p.Teams)
|
||||
.HasForeignKey(d => d.TeamLeadId)
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<User>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.UserId).HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
entity.HasIndex(e => e.Username, "UQ__Users__F3DBC572843AEA6F").IsUnique();
|
||||
|
||||
entity.Property(e => e.UserId).HasColumnName("user_id");
|
||||
entity.Property(e => e.Username)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("username");
|
||||
|
||||
entity.HasMany(d => d.TeamsNavigation).WithMany(p => p.Users)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"UsersTeam",
|
||||
r => r.HasOne<Team>().WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3"),
|
||||
l => l.HasOne<User>().WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("UserId", "TeamId").HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
j.ToTable("UsersTeams");
|
||||
j.IndexerProperty<int>("UserId").HasColumnName("user_id");
|
||||
j.IndexerProperty<int>("TeamId").HasColumnName("team_id");
|
||||
});
|
||||
});
|
||||
modelBuilder.Entity<TeamMemberAvailability>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.UserId).HasColumnName("user_id");
|
||||
entity.Property(e => e.SprintId).HasColumnName("sprint_id");
|
||||
entity.Property(e => e.AvailabilityPoints).HasColumnName("availability_points");
|
||||
|
||||
entity.HasOne(d => d.Sprint).WithMany(p => p.TeamMemberAvailabilities)
|
||||
.HasForeignKey(d => d.SprintId)
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Adjustment>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.SprintId).HasColumnName("sprint_id");
|
||||
entity.Property(e => e.AdjustmentPoints).HasColumnName("adjustment_points");
|
||||
entity.Property(e => e.Reason)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("reason");
|
||||
|
||||
entity.HasOne(d => d.Sprint).WithMany(p => p.Adjustments)
|
||||
.HasForeignKey(d => d.SprintId)
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.Repositories;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BacklogController : ControllerBase
|
||||
{
|
||||
private readonly User user = Globals.curretUser;
|
||||
private readonly IStoryRepository _storyRepository;
|
||||
private readonly ISprintRepository _sprintRepository;
|
||||
private readonly IAdjustmentRepository _adjustmentRepository;
|
||||
private readonly ITeamMemberAvailabilityRepository _teamMemberAvailabilityRepository;
|
||||
|
||||
public BacklogController(IStoryRepository storyRepository,
|
||||
ISprintRepository sprintRepository,
|
||||
IAdjustmentRepository adjustmentRepository,
|
||||
ITeamMemberAvailabilityRepository teamMemberAvailabilityRepository)
|
||||
{
|
||||
_storyRepository = storyRepository;
|
||||
_sprintRepository = sprintRepository;
|
||||
user = new User
|
||||
{
|
||||
UserId = 1,
|
||||
Username = "alice_smith"
|
||||
};
|
||||
_adjustmentRepository = adjustmentRepository;
|
||||
_teamMemberAvailabilityRepository = teamMemberAvailabilityRepository;
|
||||
}
|
||||
|
||||
[HttpGet("{page}/{count}")]
|
||||
public async Task<IActionResult> GetAsync(int page, int count)
|
||||
{
|
||||
if (count <= 200)
|
||||
return Ok(await _storyRepository.GetPaginated(page, count));
|
||||
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
[HttpGet("details/{id}")]
|
||||
public async Task<IActionResult> Get(int id)
|
||||
{
|
||||
var story = await _storyRepository.GetById(id);
|
||||
|
||||
return story != null ? Ok(story) : NotFound();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostAsync([FromBody] Story story)
|
||||
{
|
||||
try
|
||||
{
|
||||
story.CreatedBy = user.UserId;
|
||||
story.StoryId = default;
|
||||
await _storyRepository.Add(story);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutAsync([FromBody] Story story)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _storyRepository.Update(story);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAsync(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _storyRepository.Delete(id);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("{searchKey}/{page}/{pageSize}")]
|
||||
public async Task<IActionResult> GetFilteredPaginated(string searchKey, int page, int pageSize)
|
||||
{
|
||||
if (pageSize <= 200)
|
||||
return Ok(await _storyRepository.GetFilteredPaginated(searchKey, page, pageSize));
|
||||
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
[HttpGet("shift/{page}/{count}")]
|
||||
public async Task<IActionResult> GetShiftAsync(int page, int count)
|
||||
{
|
||||
if (count <= 200)
|
||||
return Ok(await _sprintRepository.GetPaginated(page, count));
|
||||
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("shift/details/{id}")]
|
||||
public async Task<IActionResult> GetShift(int id)
|
||||
{
|
||||
var sprint = await _sprintRepository.GetById(id);
|
||||
|
||||
return sprint != null ? Ok(sprint) : NotFound();
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("shift")]
|
||||
public async Task<IActionResult> PostSprintAsync([FromBody] Sprint sprint)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _sprintRepository.Add(sprint);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("availability")]
|
||||
public async Task<IActionResult> GetNetAvailabilityOnShift()
|
||||
{
|
||||
var availabilities = (await _sprintRepository.GetAll())
|
||||
.Select(async s => new
|
||||
{
|
||||
sprintId = s.SprintId,
|
||||
availability = await _teamMemberAvailabilityRepository.GetTotalAvailabilityPerSprint(s.SprintId) -
|
||||
await _adjustmentRepository.GetAdjustmentsPerSprint(s.SprintId)
|
||||
})
|
||||
.Select(s => s.Result);
|
||||
|
||||
return Ok(availabilities);
|
||||
|
||||
/*int adjustmentsPerSprintTask =
|
||||
await _adjustmentRepository.GetAdjustmentsPerSprint(sprint_id);
|
||||
int devAvailabilityPerSprintTask =
|
||||
await _teamMemberAvailabilityRepository.GetTotalAvailabilityPerSprint(sprint_id);
|
||||
|
||||
return Ok(devAvailabilityPerSprintTask - adjustmentsPerSprintTask);*/
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class TestController : ControllerBase
|
||||
{
|
||||
private readonly JyrosContext _context;
|
||||
|
||||
public TestController(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> Index()
|
||||
{
|
||||
try
|
||||
{
|
||||
var teams = await _context.Teams.Include(t => t.TeamLead).ToListAsync();
|
||||
return Ok(teams);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("AddRandomTeam")]
|
||||
public async Task<ActionResult> AddRandomTeam()
|
||||
{
|
||||
try
|
||||
{
|
||||
var random = new Random();
|
||||
var team = new Team
|
||||
{
|
||||
TeamName = "Team " + random.Next(1, 1000),
|
||||
TeamDescription = "Description for team " + random.Next(1, 1000),
|
||||
TeamLeadId = 1
|
||||
};
|
||||
|
||||
_context.Teams.Add(team);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Ok(team);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
//add a method that gets a team id and returns the teamlead of that team
|
||||
[HttpGet("GetTeamLead/{teamId}")]
|
||||
public async Task<ActionResult> GetTeamLead(int teamId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var team = await _context.Teams.FirstOrDefaultAsync(t => t.TeamId == teamId);
|
||||
return Ok(team?.TeamLead);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
//add a methode that adds a team
|
||||
[HttpPost("AddTeam")]
|
||||
public async Task<ActionResult> AddTeam(Team team)
|
||||
{
|
||||
try
|
||||
{
|
||||
_context.Teams.Add(team);
|
||||
await _context.SaveChangesAsync();
|
||||
return Ok(team);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
//get all users
|
||||
[HttpGet("GetAllUsers")]
|
||||
public async Task<ActionResult> GetAllUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
var users = await _context.Users.ToListAsync();
|
||||
return Ok(users);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
//get users in a team
|
||||
[HttpGet("GetUsersInTeam/{teamId}")]
|
||||
public async Task<ActionResult> GetUsersInTeam(int teamId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var team = await _context.Teams.Include(t => t.Users).FirstOrDefaultAsync(t => t.TeamId == teamId);
|
||||
return Ok(team?.Users);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
||||
public class ShiftAvailabilityController : Controller
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly ITeamMemberAvailabilityRepository _teamMemberAvailabilityRepository;
|
||||
private readonly ISprintRepository _sprintRepository;
|
||||
private readonly IAdjustmentRepository _adjustmentRepository;
|
||||
|
||||
public ShiftAvailabilityController(IUserRepository userRepository, ITeamMemberAvailabilityRepository teamMemberAvailabilityRepository, ISprintRepository sprintRepository, IAdjustmentRepository adjustmentRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
_teamMemberAvailabilityRepository = teamMemberAvailabilityRepository;
|
||||
_sprintRepository = sprintRepository;
|
||||
_adjustmentRepository = adjustmentRepository;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
return Ok(await _teamMemberAvailabilityRepository.GetAll());
|
||||
}
|
||||
|
||||
[HttpGet("{sprintId}/{userId}")]
|
||||
public async Task<IActionResult> GetAvailability(int sprintId, int userId)
|
||||
{
|
||||
var teamMemberAvailability = await _teamMemberAvailabilityRepository.GetBySprintIdAndUserId(sprintId, userId);
|
||||
return teamMemberAvailability != null ? Ok(teamMemberAvailability) : NotFound();
|
||||
}
|
||||
|
||||
[HttpGet("{sprintId}/adjustment")]
|
||||
public async Task<IActionResult> GetAdjustmentLength(int sprintId)
|
||||
{
|
||||
var adjustments = await _adjustmentRepository.GetAll();
|
||||
var filteredAdjustments = adjustments.Where(a => a.SprintId == sprintId).ToList();
|
||||
|
||||
var totalAdjustment = filteredAdjustments.Sum(a => a.AdjustmentPoints);
|
||||
|
||||
return Ok(totalAdjustment);
|
||||
}
|
||||
|
||||
[HttpGet("{sprintId}/adjustment/all")]
|
||||
public async Task<IActionResult> GetAllAdjustments(int sprintId)
|
||||
{
|
||||
var adjustments = await _adjustmentRepository.GetAll();
|
||||
var filteredAdjustments = adjustments.Where(a => a.SprintId == sprintId).ToList();
|
||||
return Ok(filteredAdjustments);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("sprints")]
|
||||
public async Task<IActionResult> GetSprints()
|
||||
{
|
||||
return Ok(await _sprintRepository.GetAll());
|
||||
}
|
||||
|
||||
[HttpGet("sprints/{sprintId}/users")]
|
||||
public async Task<IActionResult> GetUsers(int sprintId)
|
||||
{
|
||||
return Ok(await _userRepository.GetUsersBySprintId(sprintId));
|
||||
}
|
||||
|
||||
[HttpPost("{sprintId}/adjustment")]
|
||||
public async Task<IActionResult> PostAdjustment(int sprintId, [FromBody] Adjustment adjustment)
|
||||
{
|
||||
try
|
||||
{
|
||||
adjustment.SprintId = sprintId;
|
||||
adjustment.Id = default;
|
||||
await _adjustmentRepository.Add(adjustment);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("{sprintId}/{userId}")]
|
||||
public async Task<IActionResult> PutAvailability(int sprintId, int userId, [FromBody] TeamMemberAvailability teamMemberAvailability)
|
||||
{
|
||||
try
|
||||
{
|
||||
TeamMemberAvailability existingAvailability = await _teamMemberAvailabilityRepository.GetBySprintIdAndUserId(sprintId, userId);
|
||||
existingAvailability.AvailabilityPoints = teamMemberAvailability.AvailabilityPoints;
|
||||
await _teamMemberAvailabilityRepository.Update(existingAvailability);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
using WebApi.Services;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class TicketController : ControllerBase
|
||||
{
|
||||
private readonly User user = Globals.curretUser;
|
||||
private readonly IStoryRepository _storyRepository;
|
||||
private readonly StoryPointEstimator _storyPointEstimator;
|
||||
public TicketController(IStoryRepository storyRepository)
|
||||
{
|
||||
_storyRepository = storyRepository;
|
||||
user = new User
|
||||
{
|
||||
UserId = 1,
|
||||
Username = "alice_smith"
|
||||
};
|
||||
_storyPointEstimator = new StoryPointEstimator();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetAsync()
|
||||
{
|
||||
return Ok(await _storyRepository.GetAll());
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> Get(int id)
|
||||
{
|
||||
var story = await _storyRepository.GetById(id);
|
||||
|
||||
return story != null ? Ok(story) : NotFound();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PostAsync([FromBody] Story story)
|
||||
{
|
||||
try
|
||||
{
|
||||
story.CreatedBy = user.UserId;
|
||||
story.StoryId = default;
|
||||
story.ParentId = default;
|
||||
await _storyRepository.Add(story);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public struct StatusUpdate
|
||||
{
|
||||
public string Status { get; set; }
|
||||
}
|
||||
|
||||
[HttpPut("{id}/status")]
|
||||
public async Task<IActionResult> PutAsync([FromBody] StatusUpdate status, int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var story = await _storyRepository.GetById(id);
|
||||
story.Status = status.Status;
|
||||
await _storyRepository.Update(story);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutAsync([FromBody] Story story, int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
story.StoryId = id;
|
||||
await _storyRepository.Update(story);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAsync(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var story = await _storyRepository.GetById(id);
|
||||
if (story == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
await _storyRepository.Delete(id);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("EstimateStoryPoints")]
|
||||
public async Task<IActionResult> EstimateStoryPointsAsync(string title, string? description)
|
||||
{
|
||||
var stories = await _storyRepository.GetAll();
|
||||
var storyPoints = await _storyPointEstimator.EstimateStoryPoints(title, description ?? string.Empty);
|
||||
return Ok(storyPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
public UserController(IUserRepository userRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
return Ok(await _userRepository.GetAll());
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> Get(int id)
|
||||
{
|
||||
var user = await _userRepository.GetById(id);
|
||||
return user != null ? Ok(user) : NotFound();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Post([FromBody] User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
user.UserId = default;
|
||||
await _userRepository.Add(user);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("/login")]
|
||||
public async Task<IActionResult> LogIn([FromBody]User user)
|
||||
{
|
||||
var userDb = await _userRepository.GetUserByName(user.Username);
|
||||
Console.WriteLine(user.Username);
|
||||
if (user == null)
|
||||
{
|
||||
return BadRequest(new { Message = "Invalid username" });
|
||||
}
|
||||
else if (user.Password != userDb.Password)
|
||||
{
|
||||
return BadRequest(new { Message = "Password is incorect" });
|
||||
}
|
||||
Globals.curretUser = user;
|
||||
return Ok(new {Message = "Login succes", User = userDb});
|
||||
}
|
||||
|
||||
[HttpGet("currentUser")]
|
||||
public async Task<IActionResult> GetGlobalUser()
|
||||
{
|
||||
return Ok(Globals.curretUser);
|
||||
}
|
||||
|
||||
[HttpGet("isLoggedIn")]
|
||||
public async Task<IActionResult> IsLoggedIn()
|
||||
{
|
||||
return Ok(Globals.curretUser.Username == null ? false : true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace WebApi.Enums
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
[Description("open")]
|
||||
Open,
|
||||
[Description("in progress")]
|
||||
InProgress,
|
||||
[Description("completed")]
|
||||
Completed
|
||||
}
|
||||
}
|
||||
+413
@@ -0,0 +1,413 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WebApi.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
[DbContext(typeof(JyrosContext))]
|
||||
[Migration("20241221184059_db-creation")]
|
||||
partial class dbcreation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("StoryId", "UserId")
|
||||
.HasName("PK__UsersSto__8DA87F2683494916");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UsersStories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<int>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("UserId", "TeamId")
|
||||
.HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("UsersTeams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdjustmentPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("adjustment_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Adjustments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Property<int>("SprintId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("SprintId"));
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Goal")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("goal");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("SprintId")
|
||||
.HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("StoryId"));
|
||||
|
||||
b.Property<int?>("CreatedBy")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("parent_id");
|
||||
|
||||
b.Property<int?>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)")
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("StoryPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_points");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.HasKey("StoryId")
|
||||
.HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Stories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TeamId"));
|
||||
|
||||
b.Property<string>("TeamDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasColumnName("team_description");
|
||||
|
||||
b.Property<int?>("TeamLeadId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_lead_id");
|
||||
|
||||
b.Property<string>("TeamName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("team_name");
|
||||
|
||||
b.HasKey("TeamId")
|
||||
.HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
b.HasIndex("TeamLeadId");
|
||||
|
||||
b.HasIndex(new[] { "TeamName" }, "UQ__Teams__29E35E0C9F1894C7")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Teams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AvailabilityPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("availability_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
b.HasIndex(new[] { "Username" }, "UQ__Users__F3DBC572843AEA6F")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Story", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Adjustments")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", "Team")
|
||||
.WithMany("Sprints")
|
||||
.HasForeignKey("TeamId")
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
|
||||
b.Navigation("Team");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "CreatedByNavigation")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("CreatedBy")
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
b.HasOne("WebApi.Models.Story", "Parent")
|
||||
.WithMany("InverseParent")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("SprintId")
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
b.Navigation("CreatedByNavigation");
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "TeamLead")
|
||||
.WithMany("Teams")
|
||||
.HasForeignKey("TeamLeadId")
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
|
||||
b.Navigation("TeamLead");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("TeamMemberAvailabilities")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Navigation("Adjustments");
|
||||
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Navigation("InverseParent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Navigation("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("Teams");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class dbcreation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
user_id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
username = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__Users__B9BE370FA0824176", x => x.user_id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Teams",
|
||||
columns: table => new
|
||||
{
|
||||
team_id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
team_name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
team_description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
||||
team_lead_id = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__Teams__F82DEDBCAAB0C3AF", x => x.team_id);
|
||||
table.ForeignKey(
|
||||
name: "FK__Teams__team_lead__60A75C0F",
|
||||
column: x => x.team_lead_id,
|
||||
principalTable: "Users",
|
||||
principalColumn: "user_id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Sprints",
|
||||
columns: table => new
|
||||
{
|
||||
sprint_id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
goal = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
start_date = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
end_date = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
status = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, defaultValue: "planned"),
|
||||
team_id = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__Sprints__396C1802EFA36E05", x => x.sprint_id);
|
||||
table.ForeignKey(
|
||||
name: "FK__Sprints__team_id__693CA210",
|
||||
column: x => x.team_id,
|
||||
principalTable: "Teams",
|
||||
principalColumn: "team_id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UsersTeams",
|
||||
columns: table => new
|
||||
{
|
||||
user_id = table.Column<int>(type: "int", nullable: false),
|
||||
team_id = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__UsersTea__663CE9D4131E7ED3", x => new { x.user_id, x.team_id });
|
||||
table.ForeignKey(
|
||||
name: "FK__UsersTeam__team___6477ECF3",
|
||||
column: x => x.team_id,
|
||||
principalTable: "Teams",
|
||||
principalColumn: "team_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK__UsersTeam__user___6383C8BA",
|
||||
column: x => x.user_id,
|
||||
principalTable: "Users",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Adjustments",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
user_id = table.Column<int>(type: "int", nullable: false),
|
||||
sprint_id = table.Column<int>(type: "int", nullable: false),
|
||||
adjustment_points = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__Adjustme__3214EC07B3BFDA02", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK__Adjustmen__sprin__6EC0713C",
|
||||
column: x => x.sprint_id,
|
||||
principalTable: "Sprints",
|
||||
principalColumn: "sprint_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Stories",
|
||||
columns: table => new
|
||||
{
|
||||
story_id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
title = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
|
||||
status = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true, defaultValue: "open"),
|
||||
parent_id = table.Column<int>(type: "int", nullable: true),
|
||||
sprint_id = table.Column<int>(type: "int", nullable: true),
|
||||
created_by = table.Column<int>(type: "int", nullable: true),
|
||||
story_points = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__Stories__66339C56B86254B8", x => x.story_id);
|
||||
table.ForeignKey(
|
||||
name: "FK__Stories__created__6FE99F9F",
|
||||
column: x => x.created_by,
|
||||
principalTable: "Users",
|
||||
principalColumn: "user_id");
|
||||
table.ForeignKey(
|
||||
name: "FK__Stories__parent___70DDC3D8",
|
||||
column: x => x.parent_id,
|
||||
principalTable: "Stories",
|
||||
principalColumn: "story_id");
|
||||
table.ForeignKey(
|
||||
name: "FK__Stories__sprint___6EF57B66",
|
||||
column: x => x.sprint_id,
|
||||
principalTable: "Sprints",
|
||||
principalColumn: "sprint_id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TeamMemberAvailabilities",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
user_id = table.Column<int>(type: "int", nullable: false),
|
||||
sprint_id = table.Column<int>(type: "int", nullable: false),
|
||||
availability_points = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__TeamMemb__3214EC07A9A5EE06", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK__TeamMembe__sprin__6DCC4D03",
|
||||
column: x => x.sprint_id,
|
||||
principalTable: "Sprints",
|
||||
principalColumn: "sprint_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UsersStories",
|
||||
columns: table => new
|
||||
{
|
||||
story_id = table.Column<int>(type: "int", nullable: false),
|
||||
user_id = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__UsersSto__8DA87F2683494916", x => new { x.story_id, x.user_id });
|
||||
table.ForeignKey(
|
||||
name: "FK__UsersStor__story__73BA3083",
|
||||
column: x => x.story_id,
|
||||
principalTable: "Stories",
|
||||
principalColumn: "story_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK__UsersStor__user___74AE54BC",
|
||||
column: x => x.user_id,
|
||||
principalTable: "Users",
|
||||
principalColumn: "user_id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Adjustments_sprint_id",
|
||||
table: "Adjustments",
|
||||
column: "sprint_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Sprints_team_id",
|
||||
table: "Sprints",
|
||||
column: "team_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Stories_created_by",
|
||||
table: "Stories",
|
||||
column: "created_by");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Stories_parent_id",
|
||||
table: "Stories",
|
||||
column: "parent_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Stories_sprint_id",
|
||||
table: "Stories",
|
||||
column: "sprint_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TeamMemberAvailabilities_sprint_id",
|
||||
table: "TeamMemberAvailabilities",
|
||||
column: "sprint_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Teams_team_lead_id",
|
||||
table: "Teams",
|
||||
column: "team_lead_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UQ__Teams__29E35E0C9F1894C7",
|
||||
table: "Teams",
|
||||
column: "team_name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UQ__Users__F3DBC572843AEA6F",
|
||||
table: "Users",
|
||||
column: "username",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UsersStories_user_id",
|
||||
table: "UsersStories",
|
||||
column: "user_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UsersTeams_team_id",
|
||||
table: "UsersTeams",
|
||||
column: "team_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Adjustments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TeamMemberAvailabilities");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UsersStories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UsersTeams");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Stories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Sprints");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Teams");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WebApi.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
[DbContext(typeof(JyrosContext))]
|
||||
[Migration("20241221195345_added-priority")]
|
||||
partial class addedpriority
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("StoryId", "UserId")
|
||||
.HasName("PK__UsersSto__8DA87F2683494916");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UsersStories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<int>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("UserId", "TeamId")
|
||||
.HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("UsersTeams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdjustmentPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("adjustment_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Adjustments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Property<int>("SprintId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("SprintId"));
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Goal")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("goal");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("SprintId")
|
||||
.HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("StoryId"));
|
||||
|
||||
b.Property<int?>("CreatedBy")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("parent_id");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("priority");
|
||||
|
||||
b.Property<int?>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)")
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("StoryPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_points");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.HasKey("StoryId")
|
||||
.HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Stories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TeamId"));
|
||||
|
||||
b.Property<string>("TeamDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasColumnName("team_description");
|
||||
|
||||
b.Property<int?>("TeamLeadId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_lead_id");
|
||||
|
||||
b.Property<string>("TeamName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("team_name");
|
||||
|
||||
b.HasKey("TeamId")
|
||||
.HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
b.HasIndex("TeamLeadId");
|
||||
|
||||
b.HasIndex(new[] { "TeamName" }, "UQ__Teams__29E35E0C9F1894C7")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Teams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AvailabilityPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("availability_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
b.HasIndex(new[] { "Username" }, "UQ__Users__F3DBC572843AEA6F")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Story", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Adjustments")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", "Team")
|
||||
.WithMany("Sprints")
|
||||
.HasForeignKey("TeamId")
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
|
||||
b.Navigation("Team");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "CreatedByNavigation")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("CreatedBy")
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
b.HasOne("WebApi.Models.Story", "Parent")
|
||||
.WithMany("InverseParent")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("SprintId")
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
b.Navigation("CreatedByNavigation");
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "TeamLead")
|
||||
.WithMany("Teams")
|
||||
.HasForeignKey("TeamLeadId")
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
|
||||
b.Navigation("TeamLead");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("TeamMemberAvailabilities")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Navigation("Adjustments");
|
||||
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Navigation("InverseParent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Navigation("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("Teams");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addedpriority : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "priority",
|
||||
table: "Stories",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 1);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "priority",
|
||||
table: "Stories");
|
||||
}
|
||||
}
|
||||
}
|
||||
+421
@@ -0,0 +1,421 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WebApi.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
[DbContext(typeof(JyrosContext))]
|
||||
[Migration("20241222003947_test")]
|
||||
partial class test
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("StoryId", "UserId")
|
||||
.HasName("PK__UsersSto__8DA87F2683494916");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UsersStories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<int>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("UserId", "TeamId")
|
||||
.HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("UsersTeams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdjustmentPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("adjustment_points");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Adjustments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Property<int>("SprintId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("SprintId"));
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Goal")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("goal");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("SprintId")
|
||||
.HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("StoryId"));
|
||||
|
||||
b.Property<int?>("CreatedBy")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("parent_id");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("priority");
|
||||
|
||||
b.Property<int?>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)")
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("StoryPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_points");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.HasKey("StoryId")
|
||||
.HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Stories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TeamId"));
|
||||
|
||||
b.Property<string>("TeamDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasColumnName("team_description");
|
||||
|
||||
b.Property<int?>("TeamLeadId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_lead_id");
|
||||
|
||||
b.Property<string>("TeamName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("team_name");
|
||||
|
||||
b.HasKey("TeamId")
|
||||
.HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
b.HasIndex("TeamLeadId");
|
||||
|
||||
b.HasIndex(new[] { "TeamName" }, "UQ__Teams__29E35E0C9F1894C7")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Teams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AvailabilityPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("availability_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
b.HasIndex(new[] { "Username" }, "UQ__Users__F3DBC572843AEA6F")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Story", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Adjustments")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", "Team")
|
||||
.WithMany("Sprints")
|
||||
.HasForeignKey("TeamId")
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
|
||||
b.Navigation("Team");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "CreatedByNavigation")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("CreatedBy")
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
b.HasOne("WebApi.Models.Story", "Parent")
|
||||
.WithMany("InverseParent")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("SprintId")
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
b.Navigation("CreatedByNavigation");
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "TeamLead")
|
||||
.WithMany("Teams")
|
||||
.HasForeignKey("TeamLeadId")
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
|
||||
b.Navigation("TeamLead");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("TeamMemberAvailabilities")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Navigation("Adjustments");
|
||||
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Navigation("InverseParent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Navigation("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("Teams");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class test : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "user_id",
|
||||
table: "Adjustments");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "reason",
|
||||
table: "Adjustments",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "reason",
|
||||
table: "Adjustments");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "user_id",
|
||||
table: "Adjustments",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+425
@@ -0,0 +1,425 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WebApi.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
[DbContext(typeof(JyrosContext))]
|
||||
[Migration("20250118125647_password")]
|
||||
partial class password
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("StoryId", "UserId")
|
||||
.HasName("PK__UsersSto__8DA87F2683494916");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UsersStories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<int>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("UserId", "TeamId")
|
||||
.HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("UsersTeams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdjustmentPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("adjustment_points");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Adjustments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Property<int>("SprintId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("SprintId"));
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Goal")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("goal");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("SprintId")
|
||||
.HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("StoryId"));
|
||||
|
||||
b.Property<int?>("CreatedBy")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("parent_id");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("priority");
|
||||
|
||||
b.Property<int?>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)")
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("StoryPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_points");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.HasKey("StoryId")
|
||||
.HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Stories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TeamId"));
|
||||
|
||||
b.Property<string>("TeamDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasColumnName("team_description");
|
||||
|
||||
b.Property<int?>("TeamLeadId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_lead_id");
|
||||
|
||||
b.Property<string>("TeamName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("team_name");
|
||||
|
||||
b.HasKey("TeamId")
|
||||
.HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
b.HasIndex("TeamLeadId");
|
||||
|
||||
b.HasIndex(new[] { "TeamName" }, "UQ__Teams__29E35E0C9F1894C7")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Teams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AvailabilityPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("availability_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
b.HasIndex(new[] { "Username" }, "UQ__Users__F3DBC572843AEA6F")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Story", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Adjustments")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", "Team")
|
||||
.WithMany("Sprints")
|
||||
.HasForeignKey("TeamId")
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
|
||||
b.Navigation("Team");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "CreatedByNavigation")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("CreatedBy")
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
b.HasOne("WebApi.Models.Story", "Parent")
|
||||
.WithMany("InverseParent")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("SprintId")
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
b.Navigation("CreatedByNavigation");
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "TeamLead")
|
||||
.WithMany("Teams")
|
||||
.HasForeignKey("TeamLeadId")
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
|
||||
b.Navigation("TeamLead");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("TeamMemberAvailabilities")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Navigation("Adjustments");
|
||||
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Navigation("InverseParent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Navigation("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("Teams");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class password : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Password",
|
||||
table: "Users",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Password",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
+422
@@ -0,0 +1,422 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using WebApi.Context;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApi.Migrations
|
||||
{
|
||||
[DbContext(typeof(JyrosContext))]
|
||||
partial class JyrosContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("StoryId", "UserId")
|
||||
.HasName("PK__UsersSto__8DA87F2683494916");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UsersStories", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.Property<int>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("UserId", "TeamId")
|
||||
.HasName("PK__UsersTea__663CE9D4131E7ED3");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("UsersTeams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdjustmentPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("adjustment_points");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__Adjustme__3214EC07B3BFDA02");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Adjustments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Property<int>("SprintId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("SprintId"));
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Goal")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("goal");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasDefaultValue("planned")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("TeamId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
b.HasKey("SprintId")
|
||||
.HasName("PK__Sprints__396C1802EFA36E05");
|
||||
|
||||
b.HasIndex("TeamId");
|
||||
|
||||
b.ToTable("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Property<int>("StoryId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("StoryId"));
|
||||
|
||||
b.Property<int?>("CreatedBy")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("created_by");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("parent_id");
|
||||
|
||||
b.Property<int>("Priority")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("priority");
|
||||
|
||||
b.Property<int?>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)")
|
||||
.HasDefaultValue("open")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<int?>("StoryPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("story_points");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("title");
|
||||
|
||||
b.HasKey("StoryId")
|
||||
.HasName("PK__Stories__66339C56B86254B8");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("Stories");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Property<int>("TeamId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("TeamId"));
|
||||
|
||||
b.Property<string>("TeamDescription")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasColumnName("team_description");
|
||||
|
||||
b.Property<int?>("TeamLeadId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("team_lead_id");
|
||||
|
||||
b.Property<string>("TeamName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("team_name");
|
||||
|
||||
b.HasKey("TeamId")
|
||||
.HasName("PK__Teams__F82DEDBCAAB0C3AF");
|
||||
|
||||
b.HasIndex("TeamLeadId");
|
||||
|
||||
b.HasIndex(new[] { "TeamName" }, "UQ__Teams__29E35E0C9F1894C7")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Teams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AvailabilityPoints")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("availability_points");
|
||||
|
||||
b.Property<int>("SprintId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("sprint_id");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("PK__TeamMemb__3214EC07A9A5EE06");
|
||||
|
||||
b.HasIndex("SprintId");
|
||||
|
||||
b.ToTable("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasColumnName("user_id");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)")
|
||||
.HasColumnName("username");
|
||||
|
||||
b.HasKey("UserId")
|
||||
.HasName("PK__Users__B9BE370FA0824176");
|
||||
|
||||
b.HasIndex(new[] { "Username" }, "UQ__Users__F3DBC572843AEA6F")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersStory", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Story", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("StoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__story__73BA3083");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersStor__user___74AE54BC");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UsersTeam", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TeamId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__team___6477ECF3");
|
||||
|
||||
b.HasOne("WebApi.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__UsersTeam__user___6383C8BA");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Adjustment", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Adjustments")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__Adjustmen__sprin__6EC0713C");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Team", "Team")
|
||||
.WithMany("Sprints")
|
||||
.HasForeignKey("TeamId")
|
||||
.HasConstraintName("FK__Sprints__team_id__693CA210");
|
||||
|
||||
b.Navigation("Team");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "CreatedByNavigation")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("CreatedBy")
|
||||
.HasConstraintName("FK__Stories__created__6FE99F9F");
|
||||
|
||||
b.HasOne("WebApi.Models.Story", "Parent")
|
||||
.WithMany("InverseParent")
|
||||
.HasForeignKey("ParentId")
|
||||
.HasConstraintName("FK__Stories__parent___70DDC3D8");
|
||||
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("Stories")
|
||||
.HasForeignKey("SprintId")
|
||||
.HasConstraintName("FK__Stories__sprint___6EF57B66");
|
||||
|
||||
b.Navigation("CreatedByNavigation");
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.User", "TeamLead")
|
||||
.WithMany("Teams")
|
||||
.HasForeignKey("TeamLeadId")
|
||||
.HasConstraintName("FK__Teams__team_lead__60A75C0F");
|
||||
|
||||
b.Navigation("TeamLead");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.TeamMemberAvailability", b =>
|
||||
{
|
||||
b.HasOne("WebApi.Models.Sprint", "Sprint")
|
||||
.WithMany("TeamMemberAvailabilities")
|
||||
.HasForeignKey("SprintId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("FK__TeamMembe__sprin__6DCC4D03");
|
||||
|
||||
b.Navigation("Sprint");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Sprint", b =>
|
||||
{
|
||||
b.Navigation("Adjustments");
|
||||
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("TeamMemberAvailabilities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Story", b =>
|
||||
{
|
||||
b.Navigation("InverseParent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.Team", b =>
|
||||
{
|
||||
b.Navigation("Sprints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApi.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Stories");
|
||||
|
||||
b.Navigation("Teams");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class Adjustment
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int SprintId { get; set; }
|
||||
public int AdjustmentPoints { get; set; }
|
||||
public string Reason { get; set; } = null!;
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual Sprint? Sprint { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class Sprint
|
||||
{
|
||||
|
||||
public int SprintId { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string? Goal { get; set; }
|
||||
|
||||
public DateOnly StartDate { get; set; }
|
||||
|
||||
public DateOnly EndDate { get; set; }
|
||||
|
||||
public string? Status { get; set; }
|
||||
|
||||
public int? TeamId { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Story> Stories { get; set; } = new List<Story>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<TeamMemberAvailability> TeamMemberAvailabilities { get; set; } = new List<TeamMemberAvailability>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Adjustment> Adjustments { get; set; } = new List<Adjustment>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual Team? Team { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class Story
|
||||
{
|
||||
public int StoryId { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? Status { get; set; }
|
||||
|
||||
public int Priority { get; set; }
|
||||
|
||||
public int? ParentId { get; set; }
|
||||
|
||||
public int? SprintId { get; set; }
|
||||
|
||||
public int? CreatedBy { get; set; }
|
||||
|
||||
public int? StoryPoints { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
||||
public virtual User? CreatedByNavigation { get; set; }
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
||||
public virtual ICollection<Story> InverseParent { get; set; } = new List<Story>();
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
||||
public virtual Story? Parent { get; set; }
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
||||
public virtual Sprint? Sprint { get; set; }
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
|
||||
public virtual ICollection<User> Users { get; set; } = new List<User>();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class Team
|
||||
{
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int TeamId { get; set; }
|
||||
|
||||
public string TeamName { get; set; } = null!;
|
||||
|
||||
public string? TeamDescription { get; set; }
|
||||
|
||||
public int? TeamLeadId { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Sprint> Sprints { get; set; } = new List<Sprint>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual User? TeamLead { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<User> Users { get; set; } = new List<User>();
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class TeamMemberAvailability
|
||||
{
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int SprintId { get; set; }
|
||||
|
||||
public int AvailabilityPoints { get; set; }
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual Sprint? Sprint { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class User
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string Username { get; set; } = null!;
|
||||
|
||||
public string Password { get; set; } = string.Empty!;
|
||||
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Story> Stories { get; set; } = new List<Story>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Team> Teams { get; set; } = new List<Team>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Story> StoriesNavigation { get; set; } = new List<Story>();
|
||||
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public virtual ICollection<Team> TeamsNavigation { get; set; } = new List<Team>();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.Repositories;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowLocalhost3000",
|
||||
builder => builder
|
||||
.WithOrigins("http://localhost:5173", "https://localhost:5173", "http://192.168.1.138") // Include both HTTP and HTTPS origins
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials());
|
||||
});
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
builder.Services.AddDbContext<JyrosContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration["JyrosContext"]);
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<IStoryRepository, StoryRepository>();
|
||||
builder.Services.AddScoped<ITeamRepository, TeamRepository>();
|
||||
builder.Services.AddScoped<ISprintRepository, SprintRepository>();
|
||||
builder.Services.AddScoped<IUserRepository, UserRepository>();
|
||||
builder.Services.AddScoped<ITeamMemberAvailabilityRepository, TeamMemberAvailabilityRepository>();
|
||||
builder.Services.AddScoped<IAdjustmentRepository, AdjustmentRepository>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors("AllowLocalhost3000");
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
public static class Globals
|
||||
{
|
||||
public static User curretUser = new User();
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:21000",
|
||||
"sslPort": 44376
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5047",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7048;http://localhost:5047",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class AdjustmentRepository : IAdjustmentRepository
|
||||
{
|
||||
private readonly JyrosContext _context;
|
||||
public AdjustmentRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Adjustment>> GetAll()
|
||||
{
|
||||
return await _context.Adjustments.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Adjustment> Add(Adjustment entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
entity.Id = default;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
_context.Adjustments.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Adjustment> Delete(int id)
|
||||
{
|
||||
var entity = await _context.Adjustments.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
_context.Adjustments.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Adjustment> GetById(int id)
|
||||
{
|
||||
return await _context.Adjustments.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<Adjustment> Update(Adjustment entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Adjustment>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.Adjustments.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetAdjustmentsPerSprint(int sprintId)
|
||||
{
|
||||
return await _context.Adjustments
|
||||
.Where(a => a.SprintId == sprintId)
|
||||
.SumAsync(a => a.AdjustmentPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class SprintRepository : ISprintRepository
|
||||
{
|
||||
public readonly JyrosContext _context;
|
||||
|
||||
public SprintRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Sprint>> GetAll()
|
||||
{
|
||||
return await _context.Sprints.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Sprint> Add(Sprint entity)
|
||||
{
|
||||
_context.Sprints.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Sprint> Delete(int id)
|
||||
{
|
||||
var entity = await _context.Sprints.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
_context.Sprints.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Sprint> GetById(int id)
|
||||
{
|
||||
return await _context.Sprints.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<Sprint> Update(Sprint entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Sprint>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.Sprints.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class StoryRepository : IStoryRepository
|
||||
{
|
||||
public readonly JyrosContext _context;
|
||||
public StoryRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Story>> GetAll()
|
||||
{
|
||||
return await _context.Stories.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Story> Add(Story entity)
|
||||
{
|
||||
_context.Stories.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Story> Delete(int id)
|
||||
{
|
||||
var entity = await _context.Stories.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
_context.Stories.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Story> GetById(int id)
|
||||
{
|
||||
return await _context.Stories.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<Story> Update(Story entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Story>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.Stories.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Story>> GetFilteredPaginated(string searchKey, int page, int pageSize)
|
||||
{
|
||||
return await _context.Stories.Where(s => s.Title.Contains(searchKey)).Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class TeamMemberAvailabilityRepository : ITeamMemberAvailabilityRepository
|
||||
{
|
||||
private readonly JyrosContext _context;
|
||||
public TeamMemberAvailabilityRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public async Task<IEnumerable<TeamMemberAvailability>> GetAll()
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities.ToListAsync();
|
||||
}
|
||||
public async Task<TeamMemberAvailability> Add(TeamMemberAvailability entity)
|
||||
{
|
||||
_context.TeamMemberAvailabilities.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
public async Task<TeamMemberAvailability> Delete(int id)
|
||||
{
|
||||
var entity = await _context.TeamMemberAvailabilities.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
_context.TeamMemberAvailabilities.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
public async Task<TeamMemberAvailability> GetById(int id)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities.FindAsync(id);
|
||||
}
|
||||
public async Task<TeamMemberAvailability> Update(TeamMemberAvailability entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TeamMemberAvailability>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<TeamMemberAvailability> GetBySprintIdAndUserId(int sprintId, int userId)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities.FirstOrDefaultAsync(tma => tma.SprintId == sprintId && tma.UserId == userId);
|
||||
}
|
||||
|
||||
public async Task<TeamMemberAvailability> GetAvailabilityBySprintIdAndUserId(int sprintId, int userId)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities.FirstOrDefaultAsync(tma => tma.SprintId == sprintId && tma.UserId == userId);
|
||||
}
|
||||
|
||||
public async Task<int> GetTotalAvailabilityPerSprint(int sprintId)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities
|
||||
.Where(tma => tma.SprintId == sprintId)
|
||||
.SumAsync(tma => tma.AvailabilityPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class TeamRepository : ITeamRepository
|
||||
{
|
||||
|
||||
private readonly JyrosContext _context;
|
||||
public TeamRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Team>> GetAll()
|
||||
{
|
||||
return await _context.Teams.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Team> Add(Team entity)
|
||||
{
|
||||
_context.Teams.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Team> Delete(int id)
|
||||
{
|
||||
var entity = await _context.Teams.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
_context.Teams.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<Team> GetById(int id)
|
||||
{
|
||||
return await _context.Teams.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<Team> Update(Team entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Team>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.Teams.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
using WebApi.RepositoryInterfaces;
|
||||
|
||||
namespace WebApi.Repositories
|
||||
{
|
||||
public class UserRepository : IUserRepository
|
||||
{
|
||||
private readonly JyrosContext _context;
|
||||
public UserRepository(JyrosContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> GetAll()
|
||||
{
|
||||
return await _context.Users.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<User> Add(User entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
entity.UserId =default;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
_context.Users.Add(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<User> Delete(int id)
|
||||
{
|
||||
var entity = await _context.Users.FindAsync(id);
|
||||
if (entity == null)
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
_context.Users.Remove(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<User> GetById(int id)
|
||||
{
|
||||
return await _context.Users.FindAsync(id);
|
||||
}
|
||||
|
||||
public async Task<User> Update(User entity)
|
||||
{
|
||||
_context.Entry(entity).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> GetPaginated(int page, int pageSize)
|
||||
{
|
||||
return await _context.Users.Skip((page - 1) * pageSize).Take(pageSize).ToListAsync();
|
||||
}
|
||||
public async Task<IEnumerable<User>> GetUsersBySprintId(int sprintId)
|
||||
{
|
||||
return await _context.TeamMemberAvailabilities
|
||||
.Where(tma => tma.SprintId == sprintId)
|
||||
.Join(_context.Users,
|
||||
tma => tma.UserId,
|
||||
user => user.UserId,
|
||||
(tma, user) => user)
|
||||
.ToListAsync();
|
||||
}
|
||||
public async Task<User> GetUserByName(string name)
|
||||
{
|
||||
return await _context.Users.Where(u => u.Username == name).FirstAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface IAdjustmentRepository : IRepository<Adjustment>
|
||||
{
|
||||
Task<int> GetAdjustmentsPerSprint(int sprintId);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface IRepository<T> where T : class
|
||||
{
|
||||
Task<IEnumerable<T>> GetAll();
|
||||
Task<T> GetById(int id);
|
||||
Task<T> Add(T entity);
|
||||
Task<T> Update(T entity);
|
||||
Task<T> Delete(int id);
|
||||
Task<IEnumerable<T>> GetPaginated(int page, int pageSize);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface ISprintRepository : IRepository<Sprint>
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface IStoryRepository : IRepository<Story>
|
||||
{
|
||||
public Task<IEnumerable<Story>> GetFilteredPaginated(string searchKey, int page, int pageSize);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface ITeamMemberAvailabilityRepository : IRepository<TeamMemberAvailability>
|
||||
{
|
||||
Task<TeamMemberAvailability> GetBySprintIdAndUserId(int sprintId, int userId);
|
||||
Task<int> GetTotalAvailabilityPerSprint(int sprintId);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface ITeamRepository : IRepository<Team>
|
||||
{
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Context;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.RepositoryInterfaces
|
||||
{
|
||||
public interface IUserRepository : IRepository<User>
|
||||
{
|
||||
public Task<IEnumerable<User>> GetUsersBySprintId(int sprintId);
|
||||
public Task<User> GetUserByName (string name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
|
||||
using BERTTokenizers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Microsoft.ML;
|
||||
using Microsoft.ML.Data;
|
||||
using Microsoft.ML.Transforms.Onnx;
|
||||
using System.Collections.Generic;
|
||||
using Tokenizers.DotNet;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.Services
|
||||
{
|
||||
public class ModelInput
|
||||
{
|
||||
[VectorType(1, 128)]
|
||||
[ColumnName("input_ids")]
|
||||
public long[] InputIds { get; set; }
|
||||
|
||||
[VectorType(1, 128)]
|
||||
[ColumnName("attention_mask")]
|
||||
public long[] AttentionMask { get; set; }
|
||||
|
||||
[VectorType(1, 128)]
|
||||
[ColumnName("token_type_ids")]
|
||||
public long[] TokenTypeIds { get; set; }
|
||||
}
|
||||
|
||||
public class ModelOutput
|
||||
{
|
||||
[VectorType(1, 6)]
|
||||
[ColumnName("output")]
|
||||
public float[] Output { get; set; }
|
||||
}
|
||||
|
||||
public class StoryPointEstimator
|
||||
{
|
||||
private readonly MLContext _mlContext;
|
||||
private readonly OnnxScoringEstimator estimator;
|
||||
private readonly String ModelPath = "./AIModels/storypoint_estimator.onnx";
|
||||
private readonly String GithubRepo = "Not-Atlassian/StoryPointEstimator";
|
||||
private readonly String ModelFilename = "storypoint_estimator.onnx";
|
||||
|
||||
public StoryPointEstimator()
|
||||
{
|
||||
_mlContext = new MLContext();
|
||||
EnsureModelExists().Wait();
|
||||
estimator = _mlContext.Transforms.ApplyOnnxModel("./AIModels/storypoint_estimator.onnx");
|
||||
}
|
||||
|
||||
|
||||
private async Task EnsureModelExists()
|
||||
{
|
||||
if (!File.Exists(ModelPath))
|
||||
{
|
||||
Console.WriteLine("Model file not found locally. Downloading...");
|
||||
await DownloadModelFromGithub();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task DownloadModelFromGithub()
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
var apiUrl = $"https://api.github.com/repos/{GithubRepo}/releases/latest";
|
||||
|
||||
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (compatible; StoryPointEstimator)");
|
||||
|
||||
var response = await httpClient.GetAsync(apiUrl);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var releaseData = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var releaseJson = System.Text.Json.JsonDocument.Parse(releaseData);
|
||||
var assets = releaseJson.RootElement.GetProperty("assets");
|
||||
|
||||
string? downloadUrl = null;
|
||||
foreach (var asset in assets.EnumerateArray())
|
||||
{
|
||||
if (asset.GetProperty("name").GetString() == ModelFilename)
|
||||
{
|
||||
downloadUrl = asset.GetProperty("browser_download_url").GetString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadUrl == null)
|
||||
{
|
||||
throw new FileNotFoundException("Model file not found in the latest GitHub release.");
|
||||
}
|
||||
|
||||
Console.WriteLine($"Downloading model from {downloadUrl}...");
|
||||
|
||||
var modelData = await httpClient.GetByteArrayAsync(downloadUrl);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(ModelPath)!);
|
||||
|
||||
await File.WriteAllBytesAsync(ModelPath, modelData);
|
||||
|
||||
Console.WriteLine($"Model downloaded and saved to {ModelPath}");
|
||||
}
|
||||
|
||||
|
||||
public async Task<int> EstimateStoryPoints(string title, string description)
|
||||
{
|
||||
var tokenizer = new BertUncasedBaseTokenizer();
|
||||
|
||||
var encoded = tokenizer.Encode(128, title + " " + description);
|
||||
|
||||
var bertInput = new ModelInput()
|
||||
{
|
||||
InputIds = encoded.Select(t => t.InputIds).ToArray(),
|
||||
AttentionMask = encoded.Select(t => t.AttentionMask).ToArray(),
|
||||
TokenTypeIds = encoded.Select(t => t.TokenTypeIds).ToArray()
|
||||
};
|
||||
var data = _mlContext.Data.LoadFromEnumerable(new List<ModelInput>());
|
||||
var transformedData = estimator.Fit(data);
|
||||
var predictionEngine = _mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(transformedData);
|
||||
var prediction = predictionEngine.Predict(bertInput);
|
||||
var index = prediction.Output.ToList().IndexOf(prediction.Output.Max());
|
||||
return index switch
|
||||
{
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
3 => 5,
|
||||
4 => 8,
|
||||
5 => 13,
|
||||
6 => int.MaxValue,
|
||||
_ => 1
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+28996
File diff suppressed because it is too large
Load Diff
+31102
File diff suppressed because it is too large
Load Diff
+28996
File diff suppressed because it is too large
Load Diff
+119547
File diff suppressed because it is too large
Load Diff
+30522
File diff suppressed because it is too large
Load Diff
+30522
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>30b475b2-745a-4042-a3e9-adb472f73fd6</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BERTTokenizers" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.20.0" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxTransformer" Version="4.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||
<PackageReference Include="Tokenizers.DotNet" Version="1.0.5" />
|
||||
<PackageReference Include="Tokenizers.DotNet.runtime.win" Version="1.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="AIModels\" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="Vocabularies\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="AIModels\tokenizer.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="C:\Users\danie\.nuget\packages\berttokenizers\1.2.0\contentFiles\any\net6.0\Vocabularies\base_uncased.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
@WebApi_HostAddress = http://localhost:5047
|
||||
|
||||
GET {{WebApi_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"JyrosContext": ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user