From 96531f17d9672b9915d0e1aa9a985067fa5bb4c9 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 21:59:53 +0400 Subject: [PATCH 1/6] refactor: replace subject course association with github subject course association seeder --- .../DatabaseSeeders/SubjectGroupAssociationSeeder.cs | 4 ++-- .../EntityGenerators/Study/SubjectCourseGenerator.cs | 2 +- .../SubjectCourseAssociationGenerator.cs | 6 +++--- .../DataAccess/SubjectCourseAssociationTest.cs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Infrastructure/Kysect.Shreks.Seeding/DatabaseSeeders/SubjectGroupAssociationSeeder.cs b/Source/Infrastructure/Kysect.Shreks.Seeding/DatabaseSeeders/SubjectGroupAssociationSeeder.cs index 0a3327a77..c19783e70 100644 --- a/Source/Infrastructure/Kysect.Shreks.Seeding/DatabaseSeeders/SubjectGroupAssociationSeeder.cs +++ b/Source/Infrastructure/Kysect.Shreks.Seeding/DatabaseSeeders/SubjectGroupAssociationSeeder.cs @@ -6,9 +6,9 @@ namespace Kysect.Shreks.Seeding.DatabaseSeeders; public class SubjectGroupAssociationSeeder : IDatabaseSeeder { - private readonly IEntityGenerator _generator; + private readonly IEntityGenerator _generator; - public SubjectGroupAssociationSeeder(IEntityGenerator generator) + public SubjectGroupAssociationSeeder(IEntityGenerator generator) { _generator = generator; } diff --git a/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/Study/SubjectCourseGenerator.cs b/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/Study/SubjectCourseGenerator.cs index 2715e28af..03a4018d3 100644 --- a/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/Study/SubjectCourseGenerator.cs +++ b/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/Study/SubjectCourseGenerator.cs @@ -33,7 +33,7 @@ protected override SubjectCourse Generate(int index) var subjectCount = _subjectGenerator.GeneratedEntities.Count; var deadlineCount = _faker.Random.Int(0, _deadlinePolicyGenerator.GeneratedEntities.Count); - + IEnumerable deadlines = Enumerable.Range(0, deadlineCount) .Select(_ => _faker.Random.Int(0, _deadlinePolicyGenerator.GeneratedEntities.Count - 1)) .Select(i => _deadlinePolicyGenerator.GeneratedEntities[i]) diff --git a/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/SubjectCourseAssociations/SubjectCourseAssociationGenerator.cs b/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/SubjectCourseAssociations/SubjectCourseAssociationGenerator.cs index 6f9afac4d..f424c09e9 100644 --- a/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/SubjectCourseAssociations/SubjectCourseAssociationGenerator.cs +++ b/Source/Infrastructure/Kysect.Shreks.Seeding/EntityGenerators/SubjectCourseAssociations/SubjectCourseAssociationGenerator.cs @@ -5,13 +5,13 @@ namespace Kysect.Shreks.Seeding.EntityGenerators; -public class SubjectCourseAssociationGenerator : EntityGeneratorBase +public class SubjectCourseAssociationGenerator : EntityGeneratorBase { private readonly IEntityGenerator _subjectCourseGenerator; private readonly Faker _faker; public SubjectCourseAssociationGenerator( - EntityGeneratorOptions options, + EntityGeneratorOptions options, IEntityGenerator subjectCourseGenerator, Faker faker) : base(options) @@ -20,7 +20,7 @@ public SubjectCourseAssociationGenerator( _faker = faker; } - protected override SubjectCourseAssociation Generate(int index) + protected override GithubSubjectCourseAssociation Generate(int index) { var count = _subjectCourseGenerator.GeneratedEntities.Count; diff --git a/Source/Tests/Kysect.Shreks.Tests/DataAccess/SubjectCourseAssociationTest.cs b/Source/Tests/Kysect.Shreks.Tests/DataAccess/SubjectCourseAssociationTest.cs index a6aea9f77..c694d31f6 100644 --- a/Source/Tests/Kysect.Shreks.Tests/DataAccess/SubjectCourseAssociationTest.cs +++ b/Source/Tests/Kysect.Shreks.Tests/DataAccess/SubjectCourseAssociationTest.cs @@ -8,13 +8,13 @@ namespace Kysect.Shreks.Tests.DataAccess; public class SubjectCourseAssociationTest : DataAccessTestBase { - private readonly IEntityGenerator _subjectCourseAssociationGenerator; + private readonly IEntityGenerator _subjectCourseAssociationGenerator; public SubjectCourseAssociationTest() { - _subjectCourseAssociationGenerator = Provider.GetRequiredService>(); + _subjectCourseAssociationGenerator = Provider.GetRequiredService>(); } - + [Fact] public async Task SaveChangesAsync_EntityAdded_NoExceptionThrown() { From 9c35bf069b2cc3d13eec1db8bd7020a108a659ef Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 22:00:21 +0400 Subject: [PATCH 2/6] test: get subject course users --- ...ithubSubjectCourseAssociationExtensions.cs | 19 ++++++ .../Kysect.Shreks.Core/Users/Student.cs | 9 +++ .../GithubSubjectCourseAssociationTest.cs | 58 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs create mode 100644 Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs diff --git a/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs b/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs new file mode 100644 index 000000000..800b405c5 --- /dev/null +++ b/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs @@ -0,0 +1,19 @@ +using Kysect.Shreks.Core.UserAssociations; + +namespace Kysect.Shreks.Core.SubjectCourseAssociations; + +public static class GithubSubjectCourseAssociationExtensions +{ + public static IReadOnlyCollection GetAllGithubUsers(this GithubSubjectCourseAssociation association) + { + return association + .SubjectCourse + .Groups + .Select(g => g.StudentGroup) + .SelectMany(g => g.Students) + .Select(u => u.User) + .SelectMany(u => u.Associations) + .OfType() + .ToList(); + } +} \ No newline at end of file diff --git a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs index 95765cdd6..3534f7b24 100644 --- a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs +++ b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs @@ -1,4 +1,5 @@ using Kysect.Shreks.Core.Study; +using Kysect.Shreks.Core.UserAssociations; using RichEntity.Annotations; namespace Kysect.Shreks.Core.Users; @@ -18,4 +19,12 @@ public Student(User user, StudentGroup group) : this(userId: user.Id) public override string ToString() => $"{User.FirstName} {User.LastName} from {Group.Name} ({UserId})"; +} + +public static class StudentExtensions +{ + public static void AddGithubAssociation(this Student student, string githubUsername) + { + var githubUserAssociation = new GithubUserAssociation(student.User, githubUsername); + } } \ No newline at end of file diff --git a/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs new file mode 100644 index 000000000..06a08d64d --- /dev/null +++ b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs @@ -0,0 +1,58 @@ +using FluentAssertions; +using Kysect.Shreks.Core.Study; +using Kysect.Shreks.Core.SubjectCourseAssociations; +using Kysect.Shreks.Core.UserAssociations; +using Kysect.Shreks.Core.Users; +using Kysect.Shreks.DataAccess.Abstractions.Extensions; +using Kysect.Shreks.Seeding.EntityGenerators; +using Microsoft.Extensions.DependencyInjection; +using Xunit; + +namespace Kysect.Shreks.Tests.DataAccess; + +public class GithubSubjectCourseAssociationTest : DataAccessTestBase +{ + private readonly IEntityGenerator _subjectCourseAssociationGenerator; + private readonly IEntityGenerator _studentGroupGenerator; + private readonly IEntityGenerator _userGenerator; + + public GithubSubjectCourseAssociationTest() + { + _subjectCourseAssociationGenerator = Provider.GetRequiredService>(); + _userGenerator = Provider.GetRequiredService>(); + _studentGroupGenerator = Provider.GetRequiredService>(); + } + + [Fact] + public async Task GetSubjectCourseGithubUser_StudentAssociationExists_AssociationShouldReturn() + { + // Arrange + string userAssociation = Guid.NewGuid().ToString(); + + User user = _userGenerator.Generate(); + StudentGroup group = _studentGroupGenerator.Generate(); + GithubSubjectCourseAssociation subjectCourseAssociation = _subjectCourseAssociationGenerator.Generate(); + + var student = new Student(user, group); + student.AddGithubAssociation(userAssociation); + subjectCourseAssociation.SubjectCourse.AddGroup(group); + group.AddStudent(student); + + // Act + await Context.Users.AddAsync(user); + await Context.Students.AddAsync(student); + await Context.StudentGroups.AddAsync(group); + await Context.SubjectCourseAssociations.AddAsync(subjectCourseAssociation); + await Context.SaveChangesAsync(); + + // Assert + IEnumerable organizationUsers = Context + .SubjectCourseAssociations + .OfType() + .Single(a => a.Id == subjectCourseAssociation.Id) + .GetAllGithubUsers() + .Select(a => a.GithubUsername); + + organizationUsers.Should().Contain(userAssociation); + } +} \ No newline at end of file From 0a1ad21707d33f8ddca07c366d9ea696037b6258 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 22:01:01 +0400 Subject: [PATCH 3/6] refactor: replace get subject course users spec with extension method --- .../SubjectCourseGithubOrganizationManager.cs | 11 +++------ .../Github/GetSubjectCourseGithubUsers.cs | 24 ------------------- 2 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 Source/Domain/Kysect.Shreks.Core/Specifications/Github/GetSubjectCourseGithubUsers.cs diff --git a/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs b/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs index 3b619e71a..27ed5b016 100644 --- a/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs +++ b/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs @@ -1,7 +1,6 @@ using Kysect.Shreks.Application.GithubWorkflow.Abstractions; -using Kysect.Shreks.Core.Extensions; -using Kysect.Shreks.Core.Specifications.Github; using Kysect.Shreks.Core.SubjectCourseAssociations; +using Kysect.Shreks.Core.UserAssociations; using Kysect.Shreks.DataAccess.Abstractions; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -36,12 +35,8 @@ public async Task UpdateOrganizations(CancellationToken cancellationToken) foreach (GithubSubjectCourseAssociation subjectAssociation in githubSubjectCourseAssociations) { - List usernames = await _context - .SubjectCourseGroups - .WithSpecification(new GetSubjectCourseGithubUsers(subjectAssociation.SubjectCourse.Id)) - .Select(association => association.GithubUsername) - .ToListAsync(cancellationToken); - + IReadOnlyCollection githubUserAssociations = subjectAssociation.GetAllGithubUsers(); + List usernames = githubUserAssociations.Select(a => a.GithubUsername).ToList(); await _inviteSender.Invite(subjectAssociation.GithubOrganizationName, usernames); await GenerateRepositories(_repositoryManager, usernames, subjectAssociation.GithubOrganizationName, subjectAssociation.TemplateRepositoryName); } diff --git a/Source/Domain/Kysect.Shreks.Core/Specifications/Github/GetSubjectCourseGithubUsers.cs b/Source/Domain/Kysect.Shreks.Core/Specifications/Github/GetSubjectCourseGithubUsers.cs deleted file mode 100644 index a8b0c731e..000000000 --- a/Source/Domain/Kysect.Shreks.Core/Specifications/Github/GetSubjectCourseGithubUsers.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Kysect.Shreks.Core.Study; -using Kysect.Shreks.Core.UserAssociations; - -namespace Kysect.Shreks.Core.Specifications.Github; - -public class GetSubjectCourseGithubUsers : ISpecification -{ - private readonly Guid _subjectCourseId; - - public GetSubjectCourseGithubUsers(Guid subjectCourseId) - { - _subjectCourseId = subjectCourseId; - } - - public IQueryable Apply(IQueryable query) - { - return query - .Where(subjectCourseGroup => subjectCourseGroup.SubjectCourseId == _subjectCourseId) - .Select(group => group.StudentGroup) - .SelectMany(group => group.Students) - .SelectMany(student => student.User.Associations) - .OfType(); - } -} \ No newline at end of file From 46f0d2534325f370ad043195a6e2bc6e354b0164 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 22:36:57 +0400 Subject: [PATCH 4/6] refactor: make extension over DbContext --- .../SubjectCourseGithubOrganizationManager.cs | 7 ++++--- ...ithubSubjectCourseAssociationExtensions.cs | 21 +++++++++++++++++++ ...ithubSubjectCourseAssociationExtensions.cs | 19 ----------------- .../Kysect.Shreks.Core/Users/Student.cs | 4 ++-- .../GithubSubjectCourseAssociationTest.cs | 10 ++++----- 5 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 Source/Application/Kysect.Shreks.Application/DatabaseContextExtensions/GithubSubjectCourseAssociationExtensions.cs delete mode 100644 Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs diff --git a/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs b/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs index 27ed5b016..af347711e 100644 --- a/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs +++ b/Source/Application/Kysect.Shreks.Application.GithubWorkflow/OrganizationManagement/SubjectCourseGithubOrganizationManager.cs @@ -1,4 +1,5 @@ -using Kysect.Shreks.Application.GithubWorkflow.Abstractions; +using Kysect.Shreks.Application.DatabaseContextExtensions; +using Kysect.Shreks.Application.GithubWorkflow.Abstractions; using Kysect.Shreks.Core.SubjectCourseAssociations; using Kysect.Shreks.Core.UserAssociations; using Kysect.Shreks.DataAccess.Abstractions; @@ -35,8 +36,8 @@ public async Task UpdateOrganizations(CancellationToken cancellationToken) foreach (GithubSubjectCourseAssociation subjectAssociation in githubSubjectCourseAssociations) { - IReadOnlyCollection githubUserAssociations = subjectAssociation.GetAllGithubUsers(); - List usernames = githubUserAssociations.Select(a => a.GithubUsername).ToList(); + IReadOnlyCollection githubUserAssociations = await _context.SubjectCourses.GetAllGithubUsers(subjectAssociation.SubjectCourse.Id); + var usernames = githubUserAssociations.Select(a => a.GithubUsername).ToList(); await _inviteSender.Invite(subjectAssociation.GithubOrganizationName, usernames); await GenerateRepositories(_repositoryManager, usernames, subjectAssociation.GithubOrganizationName, subjectAssociation.TemplateRepositoryName); } diff --git a/Source/Application/Kysect.Shreks.Application/DatabaseContextExtensions/GithubSubjectCourseAssociationExtensions.cs b/Source/Application/Kysect.Shreks.Application/DatabaseContextExtensions/GithubSubjectCourseAssociationExtensions.cs new file mode 100644 index 000000000..b7111f36f --- /dev/null +++ b/Source/Application/Kysect.Shreks.Application/DatabaseContextExtensions/GithubSubjectCourseAssociationExtensions.cs @@ -0,0 +1,21 @@ +using Kysect.Shreks.Core.Study; +using Kysect.Shreks.Core.UserAssociations; +using Microsoft.EntityFrameworkCore; + +namespace Kysect.Shreks.Application.DatabaseContextExtensions; + +public static class GithubSubjectCourseAssociationExtensions +{ + public static async Task> GetAllGithubUsers(this DbSet subjectCourses, Guid subjectCourseId) + { + return await subjectCourses + .Where(sc => sc.Id == subjectCourseId) + .SelectMany(sc => sc.Groups) + .Select(g => g.StudentGroup) + .SelectMany(g => g.Students) + .Select(u => u.User) + .SelectMany(u => u.Associations) + .OfType() + .ToListAsync(); + } +} \ No newline at end of file diff --git a/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs b/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs deleted file mode 100644 index 800b405c5..000000000 --- a/Source/Domain/Kysect.Shreks.Core/SubjectCourseAssociations/GithubSubjectCourseAssociationExtensions.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Kysect.Shreks.Core.UserAssociations; - -namespace Kysect.Shreks.Core.SubjectCourseAssociations; - -public static class GithubSubjectCourseAssociationExtensions -{ - public static IReadOnlyCollection GetAllGithubUsers(this GithubSubjectCourseAssociation association) - { - return association - .SubjectCourse - .Groups - .Select(g => g.StudentGroup) - .SelectMany(g => g.Students) - .Select(u => u.User) - .SelectMany(u => u.Associations) - .OfType() - .ToList(); - } -} \ No newline at end of file diff --git a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs index 3534f7b24..50a22bd0f 100644 --- a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs +++ b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs @@ -23,8 +23,8 @@ public override string ToString() public static class StudentExtensions { - public static void AddGithubAssociation(this Student student, string githubUsername) + public static GithubUserAssociation AddGithubAssociation(this Student student, string githubUsername) { - var githubUserAssociation = new GithubUserAssociation(student.User, githubUsername); + return new GithubUserAssociation(student.User, githubUsername); } } \ No newline at end of file diff --git a/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs index 06a08d64d..0815b4172 100644 --- a/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs +++ b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs @@ -1,9 +1,8 @@ using FluentAssertions; +using Kysect.Shreks.Application.DatabaseContextExtensions; using Kysect.Shreks.Core.Study; using Kysect.Shreks.Core.SubjectCourseAssociations; -using Kysect.Shreks.Core.UserAssociations; using Kysect.Shreks.Core.Users; -using Kysect.Shreks.DataAccess.Abstractions.Extensions; using Kysect.Shreks.Seeding.EntityGenerators; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -47,10 +46,9 @@ public async Task GetSubjectCourseGithubUser_StudentAssociationExists_Associatio // Assert IEnumerable organizationUsers = Context - .SubjectCourseAssociations - .OfType() - .Single(a => a.Id == subjectCourseAssociation.Id) - .GetAllGithubUsers() + .SubjectCourses + .GetAllGithubUsers(subjectCourseAssociation.Id) + .Result .Select(a => a.GithubUsername); organizationUsers.Should().Contain(userAssociation); From 7faebcaede396f4419a0081cc0cd85ec901337d1 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 22:41:09 +0400 Subject: [PATCH 5/6] fix: use correct subject course id in tests --- .../DataAccess/GithubSubjectCourseAssociationTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs index 0815b4172..dbf4d3cdb 100644 --- a/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs +++ b/Source/Tests/Kysect.Shreks.Tests/DataAccess/GithubSubjectCourseAssociationTest.cs @@ -47,7 +47,7 @@ public async Task GetSubjectCourseGithubUser_StudentAssociationExists_Associatio // Assert IEnumerable organizationUsers = Context .SubjectCourses - .GetAllGithubUsers(subjectCourseAssociation.Id) + .GetAllGithubUsers(subjectCourseAssociation.SubjectCourse.Id) .Result .Select(a => a.GithubUsername); From bac788d596e754bb609b3f6f6d9dbf775e920323 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Fri, 16 Sep 2022 23:04:23 +0400 Subject: [PATCH 6/6] Apply code review suggestions --- Source/Domain/Kysect.Shreks.Core/Users/Student.cs | 9 --------- .../Kysect.Shreks.Core/Users/StudentExtensions.cs | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 Source/Domain/Kysect.Shreks.Core/Users/StudentExtensions.cs diff --git a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs index 50a22bd0f..95765cdd6 100644 --- a/Source/Domain/Kysect.Shreks.Core/Users/Student.cs +++ b/Source/Domain/Kysect.Shreks.Core/Users/Student.cs @@ -1,5 +1,4 @@ using Kysect.Shreks.Core.Study; -using Kysect.Shreks.Core.UserAssociations; using RichEntity.Annotations; namespace Kysect.Shreks.Core.Users; @@ -19,12 +18,4 @@ public Student(User user, StudentGroup group) : this(userId: user.Id) public override string ToString() => $"{User.FirstName} {User.LastName} from {Group.Name} ({UserId})"; -} - -public static class StudentExtensions -{ - public static GithubUserAssociation AddGithubAssociation(this Student student, string githubUsername) - { - return new GithubUserAssociation(student.User, githubUsername); - } } \ No newline at end of file diff --git a/Source/Domain/Kysect.Shreks.Core/Users/StudentExtensions.cs b/Source/Domain/Kysect.Shreks.Core/Users/StudentExtensions.cs new file mode 100644 index 000000000..f8ad8519c --- /dev/null +++ b/Source/Domain/Kysect.Shreks.Core/Users/StudentExtensions.cs @@ -0,0 +1,11 @@ +using Kysect.Shreks.Core.UserAssociations; + +namespace Kysect.Shreks.Core.Users; + +public static class StudentExtensions +{ + public static GithubUserAssociation AddGithubAssociation(this Student student, string githubUsername) + { + return new GithubUserAssociation(student.User, githubUsername); + } +} \ No newline at end of file