-
Notifications
You must be signed in to change notification settings - Fork 2
STD-68 | Organization feature: adjust domain and persistence layer #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace StudySharp.Domain.Models | ||
| { | ||
| public enum AppearanceType | ||
| { | ||
| IsPublic = 1, | ||
| IsPrivate = 2, | ||
| IsInternal = 3, | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace StudySharp.Domain.Models | ||
| { | ||
| public sealed class DomainUser | ||
| { | ||
| public int Id { get; set; } | ||
| public int AppUserId { get; set; } | ||
| public int? TeacherId { get; set; } | ||
| public Teacher Teacher { get; set; } | ||
| public string FirstName { get; set; } | ||
| public string LastName { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using StudySharp.Domain.Contracts; | ||
|
|
||
| namespace StudySharp.Domain.Models | ||
| { | ||
| public sealed class Organization : IWithDateCreated | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe IWithDateModified too? |
||
| { | ||
| public int Id { get; set; } | ||
| public string Name { get; set; } | ||
| public string Description { get; set; } | ||
| public int OwnerId { get; set; } | ||
| public OrganizationStatus Status { get; set; } | ||
| public DateTimeOffset DateCreated { get; private set; } | ||
| void IWithDateCreated.SetDateCreated(DateTimeOffset value) => DateCreated = value; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, move this property to the last line |
||
| public List<DomainUser> Members { get; set; } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace StudySharp.Domain.Models | ||
| { | ||
| public sealed class OrganizationRepresentative | ||
| { | ||
| public int OrganizationId { get; set; } | ||
| public int MemberId { get; set; } | ||
| public bool CanCreate { get; set; } | ||
| public bool CanEdit { get; set; } | ||
| public bool CanDelete { get; set; } | ||
| public bool IsOrganizationManager { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace StudySharp.Domain.Models | ||
| { | ||
| public enum OrganizationStatus | ||
| { | ||
| New = 1, | ||
| OnConsideration = 2, | ||
| Confirmed = 3, | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,7 @@ namespace StudySharp.Domain.Models | |
| { | ||
| public sealed class Teacher | ||
| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add DomainUser to Teacher, it may help us in some situations |
||
| public int UserId { get; set; } | ||
| public int Id { get; set; } | ||
| public string FirstName { get; set; } | ||
| public string LastName { get; set; } | ||
| public List<Course> Courses { get; set; } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using Microsoft.EntityFrameworkCore; | ||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
| using StudySharp.Domain.Models; | ||
|
|
||
| namespace StudySharp.DomainServices.Configurations | ||
| { | ||
| public sealed class DomainUserConfiguration : IEntityTypeConfiguration<DomainUser> | ||
| { | ||
| public void Configure(EntityTypeBuilder<DomainUser> builder) | ||
| { | ||
| builder | ||
| .HasKey(_ => _.Id); | ||
|
|
||
| builder | ||
| .Property(_ => _.FirstName) | ||
| .IsRequired(); | ||
|
|
||
| builder | ||
| .Property(_ => _.LastName) | ||
| .IsRequired(); | ||
|
|
||
| builder | ||
| .HasOne(_ => _.Teacher) | ||
| .WithOne() | ||
| .HasForeignKey<DomainUser>(_ => _.TeacherId); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using System; | ||
| using Microsoft.EntityFrameworkCore; | ||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
| using StudySharp.Domain.Models; | ||
|
|
||
| namespace StudySharp.DomainServices.Configurations | ||
| { | ||
| public sealed class OrganizationConfiguration : IEntityTypeConfiguration<Organization> | ||
| { | ||
| public void Configure(EntityTypeBuilder<Organization> builder) | ||
| { | ||
| throw new NotImplementedException(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using System; | ||
| using Microsoft.EntityFrameworkCore; | ||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
| using StudySharp.Domain.Models; | ||
|
|
||
| namespace StudySharp.DomainServices.Configurations | ||
| { | ||
| public sealed class OrganizationRepresentativeConfiguration : IEntityTypeConfiguration<OrganizationRepresentative> | ||
| { | ||
| public void Configure(EntityTypeBuilder<OrganizationRepresentative> builder) | ||
| { | ||
| throw new NotImplementedException(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we won't have access modifiers for other entities in the future?
Maybe add "Course" to this name, or change it to more corresponding to courses