Skip to content

Commit

Permalink
Reformat Data Model 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mesquidar committed Jul 24, 2022
1 parent 3ba45e8 commit b45d733
Show file tree
Hide file tree
Showing 106 changed files with 1,851 additions and 4,816 deletions.
3 changes: 1 addition & 2 deletions Cervantes.Application/Cervantes.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DinkToPdf" Version="1.0.8" />
<PackageReference Include="RazorLight" Version="2.0.0" />
<PackageReference Include="RazorLight" Version="2.1.0" />
<PackageReference Include="RazorLight.NetCore3" Version="3.0.2" />
</ItemGroup>

Expand Down
10 changes: 9 additions & 1 deletion Cervantes.Application/GenericManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public T Add(T entity)
return entity;
}

public T Update(T entity)
{
Context.Set<T>().Update(entity);
return entity;
}

/// <summary>
/// Add entity to data context async
/// </summary>
Expand Down Expand Up @@ -76,7 +82,7 @@ public T GetById(object[] key)
/// </summary>
/// <param name="id">id</param>
/// <returns>Entity</returns>
public T GetById(int id)
public T GetById(Guid id)
{
return GetById(new object[] {id});
}
Expand All @@ -89,4 +95,6 @@ public IQueryable<T> GetAll()
{
return Context.Set<T>();
}


}
51 changes: 0 additions & 51 deletions Cervantes.Application/PDFManager.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Cervantes.Application/ProjectUserManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public ProjectUserManager(IApplicationDbContext context) : base(context)
{
}

public ProjectUser VerifyUser(int project,string user)
public ProjectUser VerifyUser(Guid project,string user)
{
return Context.Set<ProjectUser>().Where(x => x.ProjectId == project && x.UserId == user).FirstOrDefault();
return Context.Set<ProjectUser>().Where(x => x.ProjectId == project&& x.UserId == user).FirstOrDefault();
}
}
16 changes: 16 additions & 0 deletions Cervantes.Application/TaskTargetManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Cervantes.Contracts;
using Cervantes.CORE;

namespace Cervantes.Application;

public class TaskTargetManager: GenericManager<TaskTargets>, ITaskTargetManager
{
/// <summary>
/// TaskTarget Manager Constructor
/// </summary>
/// <param name="context"></param>
public TaskTargetManager(IApplicationDbContext context) : base(context)
{

}
}
15 changes: 15 additions & 0 deletions Cervantes.Application/VulnTargetManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Cervantes.Contracts;
using Cervantes.CORE;

namespace Cervantes.Application;

public class VulnTargetManager: GenericManager<VulnTargets>, IVulnTargetManager
{
/// <summary>
/// VulnTarget Manager Constructor
/// </summary>
/// <param name="context"></param>
public VulnTargetManager(IApplicationDbContext context) : base(context)
{
}
}
5 changes: 3 additions & 2 deletions Cervantes.CORE/ApplicationUser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;

namespace Cervantes.CORE;
Expand All @@ -25,5 +26,5 @@ public class ApplicationUser : IdentityUser
/// </summary>
public string Position { get; set; }

public int ClientId { get; set; }
public Guid ClientId { get; set; }
}
2 changes: 1 addition & 1 deletion Cervantes.CORE/Cervantes.CORE.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.7" />
</ItemGroup>

</Project>
7 changes: 4 additions & 3 deletions Cervantes.CORE/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ namespace Cervantes.CORE;
public class Client
{
/// <summary>
/// Porject Note Id
/// Client Id
/// </summary>
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// User who created project
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions Cervantes.CORE/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class Document
/// Porject Note Id
/// </summary>
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// Note Name
Expand All @@ -30,12 +31,12 @@ public class Document
/// <summary>
/// User who created project
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Cervantes.CORE/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Cervantes.CORE;

public enum Language
{
English = 0,
Español = 1
English = 1,
Español = 2
}
5 changes: 3 additions & 2 deletions Cervantes.CORE/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class Note
/// Porject Note Id
/// </summary>
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// Note Name
Expand All @@ -25,12 +26,12 @@ public class Note
/// <summary>
/// User who created project
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

public DateTime CreatedDate { get; set; }
Expand Down
14 changes: 10 additions & 4 deletions Cervantes.CORE/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class Project
/// </summary>
///
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// Project Name
Expand All @@ -40,24 +41,24 @@ public class Project
/// <summary>
/// User who created project
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

/// <summary>
/// Client asssociated to project
/// </summary>
[ForeignKey("ClientId")]
public virtual Client Client { get; set; }

/// <summary>
/// Client ID
/// </summary>
[ForeignKey("Client")]
public int ClientId { get; set; }
public Guid ClientId { get; set; }

/// <summary>
/// Is project a template
Expand All @@ -73,4 +74,9 @@ public class Project
/// Project Type
/// </summary>
public ProjectType ProjectType { get; set; }

/// <summary>
/// Project Language
/// </summary>
public Language Language { get; set; }
}
10 changes: 6 additions & 4 deletions Cervantes.CORE/ProjectAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class ProjectAttachment
/// Project Attachment Id
/// </summary>
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// ProjectAttachment Name
Expand All @@ -29,22 +30,23 @@ public class ProjectAttachment
/// <summary>
/// User who created the attachment
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

/// <summary>
/// Project Associated
/// </summary>
[ForeignKey("ProjectId")]
public virtual Project Project { get; set; }

/// <summary>
/// Id Project
/// </summary>
[ForeignKey("Project")]
public int ProjectId { get; set; }

public Guid ProjectId { get; set; }
}
8 changes: 4 additions & 4 deletions Cervantes.CORE/ProjectNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class ProjectNote
/// Porject Note Id
/// </summary>
[Key]
public int Id { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid Id { get; set; }

/// <summary>
/// Note Name
Expand All @@ -29,12 +30,12 @@ public class ProjectNote
/// <summary>
/// User who created project
/// </summary>
[ForeignKey("UserId")]
public virtual ApplicationUser User { get; set; }

/// <summary>
/// Id user
/// </summary>
[ForeignKey("User")]
public string UserId { get; set; }

/// <summary>
Expand All @@ -45,8 +46,7 @@ public class ProjectNote
/// <summary>
/// Id Project
/// </summary>
[ForeignKey("Project")]
public int ProjectId { get; set; }
public Guid ProjectId { get; set; }

/// <summary>
/// Visibility of the project note
Expand Down
Loading

0 comments on commit b45d733

Please sign in to comment.