fix
This commit is contained in:
@@ -130,6 +130,17 @@ public class ItemService
|
||||
return _mapper.Map<List<ItemDto>>(_itemRepository.GetByCategory(userId, categoryId));
|
||||
}
|
||||
|
||||
public List<ItemDto> GetByUncategorized(Guid userId)
|
||||
{
|
||||
var itemGlobals = _itemGlobalRepository.GetAvailableToUser(userId);
|
||||
foreach (var itemGlobal in itemGlobals)
|
||||
{
|
||||
GetOrCreate(userId, itemGlobal);
|
||||
}
|
||||
|
||||
return GetByCategory(userId, userId);
|
||||
}
|
||||
|
||||
public Exec<ItemDto, GeneralExecStatus> Update(Guid userId, Guid motionId, Guid categoryId)
|
||||
{
|
||||
var result = new Exec<ItemDto, GeneralExecStatus>(GeneralExecStatus.success);
|
||||
@@ -204,4 +215,25 @@ public class ItemService
|
||||
|
||||
return _mapper.Map<List<ItemDto>>(_itemRepository.Find(userId, term, limit));
|
||||
}
|
||||
|
||||
public GeneralExecStatus UpdateItemsCategory(Guid userId, Guid categoryId, List<Guid> items)
|
||||
{
|
||||
var category = _itemCategoryRepository.Get(userId, categoryId);
|
||||
if (category == null)
|
||||
{
|
||||
return GeneralExecStatus.not_found;
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
var dbItem = _itemRepository.GetByGlobal(userId, item);
|
||||
if (dbItem != null)
|
||||
{
|
||||
dbItem.CategoryId = category.Id;
|
||||
_itemRepository.Update(dbItem);
|
||||
}
|
||||
}
|
||||
|
||||
return GeneralExecStatus.success;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user