Skip to content
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

CmsKit - Implement MultiTenancy to MenuItem #10115

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public virtual async Task<MenuItemDto> CreateAsync(MenuItemCreateInput input)
input.Order,
input.Target,
input.ElementId,
input.CssClass
input.CssClass,
CurrentTenant.Id
);

await MenuItemRepository.InsertAsync(menuItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MenuItem : AuditedAggregateRoot<Guid>, IMultiTenant
public string DisplayName { get; protected set; }

public bool IsActive { get; set; }

[NotNull]
public string Url { get; protected set; }

Expand All @@ -39,7 +39,7 @@ public class MenuItem : AuditedAggregateRoot<Guid>, IMultiTenant

public Guid? PageId { get; protected set; }

public Guid? TenantId { get; protected set; }
public Guid? TenantId { get; protected set; }

public MenuItem(Guid id,
[NotNull] string displayName,
Expand All @@ -50,8 +50,9 @@ public class MenuItem : AuditedAggregateRoot<Guid>, IMultiTenant
int order = 0,
[CanBeNull] string target = null,
[CanBeNull] string elementId = null,
[CanBeNull] string cssClass = null)
:base(id)
[CanBeNull] string cssClass = null,
[CanBeNull] Guid? tenantId = null)
: base(id)
{
SetDisplayName(displayName);
IsActive = isActive;
Expand All @@ -62,14 +63,15 @@ public class MenuItem : AuditedAggregateRoot<Guid>, IMultiTenant
Target = target;
ElementId = elementId;
CssClass = cssClass;
TenantId = tenantId;
}

public void SetDisplayName([NotNull] string displayName)
{
DisplayName = Check.NotNullOrEmpty(displayName, nameof(displayName), MenuItemConsts.MaxDisplayNameLength);
}

public void SetUrl([NotNull]string url)
public void SetUrl([NotNull] string url)
{
Url = Check.NotNullOrEmpty(url, nameof(url), MenuItemConsts.MaxUrlLength);
}
Expand Down