Updated API route

This commit is contained in:
Santhosh S
2023-08-29 22:23:40 -04:00
parent a130aff300
commit e5eb414876
51 changed files with 1157 additions and 193 deletions

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace DamageAssesment.Api.UsersAccess.Db
{
public class Role
{
[Key]
public int Id { get; set; }
[StringLength(100)]
[Required]
public string Name { get; set; }
// add a status field
[StringLength(100)]
public string? Description { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DamageAssesment.Api.UsersAccess.Db
{
public class Token
{
[Key]
public string Id { get; set; }
[Required]
[ForeignKey("User")]
public int UserId { get; set; }
public string? RefreshToken { get; set; }
public bool? IsActive { get; set; }
}
}

View File

@ -0,0 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace DamageAssesment.Api.UsersAccess.Db
{
public class User
{
[Key]
public int Id { get; set; }
[ForeignKey("Employee")]
public string EmployeeId { get; set; }
[ForeignKey("Role")]
[Required]
public int RoleId { get; set; }
[Required]
public bool? IsActive { get; set; } = true;
[Required]
public DateTime? CreateDate { get; set; } = DateTime.Now;
public DateTime? UpdateDate { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace DamageAssesment.Api.UsersAccess.Db
{
public class UsersAccessDbContext:DbContext
{
public DbSet<Db.User> Users { get; set; }
public DbSet<Db.Role> Roles { get; set; }
public DbSet<Db.Token> Tokens { get; set; }
public UsersAccessDbContext(DbContextOptions options) : base(options)
{
}
}
}