side bar Menu Model define
This commit is contained in:
parent
afe20b404a
commit
56d3b754d9
14
Marco.Pms.CacheHelper/SidebarMenu.cs
Normal file
14
Marco.Pms.CacheHelper/SidebarMenu.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Marco.Pms.Model.AppMenu;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Marco.Pms.CacheHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IMongoCollection<MenuSection>? _collection;
|
||||||
|
|
||||||
|
}
|
46
Marco.Pms.Model/AppMenu/SideBarMenu.cs
Normal file
46
Marco.Pms.Model/AppMenu/SideBarMenu.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
using MongoDB.Bson;
|
||||||
|
using MongoDB.Bson.Serialization.Attributes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Marco.Pms.Model.AppMenu
|
||||||
|
{
|
||||||
|
public class MenuSection
|
||||||
|
{
|
||||||
|
[BsonId]
|
||||||
|
[BsonRepresentation(BsonType.String)]
|
||||||
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
public string? Header { get; set; }
|
||||||
|
public string? Title { get; set; }
|
||||||
|
public List<MenuItem> Items { get; set; } = new List<MenuItem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MenuItem
|
||||||
|
{
|
||||||
|
[BsonId]
|
||||||
|
[BsonRepresentation(BsonType.String)]
|
||||||
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
public string? Text { get; set; }
|
||||||
|
public string? Icon { get; set; }
|
||||||
|
public bool? Available { get; set; }
|
||||||
|
public string? Link { get; set; }
|
||||||
|
public List<SubMenuItem> Submenu { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SubMenuItem
|
||||||
|
{
|
||||||
|
|
||||||
|
[BsonId]
|
||||||
|
[BsonRepresentation(BsonType.String)]
|
||||||
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
public string Text { get; set; }
|
||||||
|
public bool Available { get; set; }
|
||||||
|
public string Link { get; set; }
|
||||||
|
public string permissionKey { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
72
Marco.Pms.Services/Controllers/AppMenuController.cs
Normal file
72
Marco.Pms.Services/Controllers/AppMenuController.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using Marco.Pms.Model.AppMenu;
|
||||||
|
using Marco.Pms.Model.Employees;
|
||||||
|
using Marco.Pms.Model.Entitlements;
|
||||||
|
using Marco.Pms.Services.Service;
|
||||||
|
using Marco.Pms.Services.Service.ServiceInterfaces;
|
||||||
|
using MarcoBMS.Services.Helpers;
|
||||||
|
using Microsoft.AspNetCore.Http.HttpResults;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Marco.Pms.Services.Controllers
|
||||||
|
{
|
||||||
|
public class AppMenuController
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly UserHelper _userHelper;
|
||||||
|
private readonly EmployeeHelper _employeeHelper;
|
||||||
|
private readonly RolesHelper _rolesHelper;
|
||||||
|
|
||||||
|
public AppMenuController(EmployeeHelper employeeHelper, IProjectServices projectServices, UserHelper userHelper, RolesHelper rolesHelper) {
|
||||||
|
|
||||||
|
_userHelper = userHelper;
|
||||||
|
_employeeHelper = employeeHelper;
|
||||||
|
_rolesHelper = rolesHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet("/appMenu")]
|
||||||
|
|
||||||
|
public async Task<IActionResult> getAppSideBarMenu()
|
||||||
|
{
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("/create/appsidebar")]
|
||||||
|
public async Task<IActionResult> PostAppSideBarMenu([FromForm] MenuSection sidebarmenu)
|
||||||
|
{
|
||||||
|
var user = await _userHelper.GetCurrentEmployeeAsync();
|
||||||
|
Employee? loginUser = null;
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
loginUser = await _employeeHelper.GetEmployeeByApplicationUserID(user.Id.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
List<FeaturePermission> featurePermission = await _rolesHelper.GetFeaturePermissionByEmployeeId(loginUser.Id);
|
||||||
|
string[] projectsId = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Ok(loginUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user