Skip to content

Commit

Permalink
add model
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong committed Apr 6, 2024
1 parent d48e3cc commit eee7b9d
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 0 deletions.
14 changes: 14 additions & 0 deletions DotnetGRPC/Model/DTO/Email.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.IO;

namespace DotnetGRPC.Model.DTO
{
public class Email
{
public string[] To { get; set; }
public string[] Cc { get; set; }
public string[] Bcc { get; set; }
public string Subject { get; set; }
public string HtmlBody { get; set; }
public FileInfo FileAttachment { get; set; }
}
}
11 changes: 11 additions & 0 deletions DotnetGRPC/Model/DTO/EmailSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace DotnetGRPC.Model.DTO
{
public class EmailSettings
{
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public bool EnableSsl { get; set; }
}
}
25 changes: 25 additions & 0 deletions DotnetGRPC/Model/Faculty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DotnetGRPC.Model
{
[Table("faculty")]
public class Faculty
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }

[Required]
public string Name { get; set; }

[Required]
[Column("created_at")]
public DateTime CreatedAt { get; set; }

[Required]
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
}
}
42 changes: 42 additions & 0 deletions DotnetGRPC/Model/Notification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DotnetGRPC.Model
{
[Table("notification")]
public class Notification
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("id")]
public long Id { get; set; }

[ForeignKey("UserId")]
public User User { get; set; }

[Required]
[Column("user_id")]
public long UserId { get; set; }


[Required]
[Column("with_email")]
public bool WithEmail { get; set; }

[Required]
[Column("content")]
public string Content { get; set; }

[Column("url")]
public string? Url { get; set; }

[Required]
[Column("seen")]
public bool Seen { get; set; }

[Required]
[Column("created_at")]
public DateTime CreatedAt { get; set; }
}
}
39 changes: 39 additions & 0 deletions DotnetGRPC/Model/Template.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DotnetGRPC.Model
{
[Table("template")]
public class Template
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("id")]
public long Id { get; set; }

[Required]
[Column("template_code")]
public string TemplateCode { get; set; }

[Required]
[Column("template_name")]
public string TemplateName { get; set; }

[Required]
[Column("template_description")]
public string TemplateDescription { get; set; }

[Required]
[Column("template_content")]
public string TemplateContent { get; set; }

[Required]
[Column("created_at")]
public DateTime CreatedAt { get; set; }

[Required]
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }
}
}
68 changes: 68 additions & 0 deletions DotnetGRPC/Model/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DotnetGRPC.Model
{
[Table("user")]
public class User
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("id")]
public long Id { get; set; }

[Required]
[Column("username")]
public string Username { get; set; }

Check warning on line 17 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Username' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 17 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Username' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("password")]
public string Password { get; set; }

Check warning on line 21 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Password' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("secret")]
public string Secret { get; set; }

Check warning on line 25 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Secret' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("role")]
public RoleType Role { get; set; }

public enum RoleType
{
Administrator, Student, Guest
}

[Required]
[Column("email")]
public string Email { get; set; }

Check warning on line 38 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Email' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("first_name")]
public string FirstName { get; set; }

Check warning on line 42 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'FirstName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("last_name")]
public string LastName { get; set; }

Check warning on line 46 in DotnetGRPC/Model/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'LastName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[Required]
[Column("account_status")]
public AccountType AccountStatus { get; set; }

public enum AccountType
{
Active, Locked, Inactive
}

[Required]
[Column("created_at")]
public DateTime CreatedAt { get; set; }

[Required]
[Column("updated_at")]
public DateTime UpdatedAt { get; set; }

[ForeignKey("FacultyId")]
public Faculty Faculty { get; set; }
}
}

0 comments on commit eee7b9d

Please sign in to comment.