Skip to content

Commit

Permalink
Update custom craft count GQL
Browse files Browse the repository at this point in the history
- Now the `itemSubType` parameter is nullable
- If no `itemSubType` parameter provided, return all data
  • Loading branch information
U-lis committed Aug 14, 2024
1 parent 263016e commit 7e957c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,15 @@ public NineChroniclesSummaryQuery(MySqlStore store, StandaloneContext standalone
Field<ListGraphType<CustomEquipmentCraftIconCountType>>(
"customEquipmentCraftIconCount",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<StringGraphType>>
new QueryArgument<StringGraphType>
{
Name = "itemSubType",
Description = "ItemSubType to get craft count for icons",
}
),
resolve: context =>
{
var itemSubType = context.GetArgument<string>("itemSubType");
var itemSubType = context.GetArgument<string?>("itemSubType");
return Store.GetCustomEquipmentCraftCount(itemSubType);
}
);
Expand Down
6 changes: 4 additions & 2 deletions NineChronicles.DataProvider/Store/MySql/CustomCraftStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ await ctx.CustomEquipmentCraftCount.AddAsync(new CustomEquipmentCraftCountModel
}
}

public partial List<CustomEquipmentCraftCountModel> GetCustomEquipmentCraftCount(string itemSubType)
public partial List<CustomEquipmentCraftCountModel> GetCustomEquipmentCraftCount(string? itemSubType)
{
using var ctx = _dbContextFactory.CreateDbContext();
return ctx.CustomEquipmentCraftCount.Where(c => c.ItemSubType == itemSubType).ToList();
return itemSubType is null
? ctx.CustomEquipmentCraftCount.ToList()
: ctx.CustomEquipmentCraftCount.Where(c => c.ItemSubType == itemSubType).ToList();
}
}
}
2 changes: 1 addition & 1 deletion NineChronicles.DataProvider/Store/MySqlStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ public void StoreRuneSummonFailList(List<RuneSummonFailModel> runeSummonFailList
// CustomCraft
public partial Task StoreCustomEquipmentCraftList(List<CustomEquipmentCraftModel> customEquipmentCraftList);

public partial List<CustomEquipmentCraftCountModel> GetCustomEquipmentCraftCount(string itemSubType);
public partial List<CustomEquipmentCraftCountModel> GetCustomEquipmentCraftCount(string? itemSubType);
/* CustomCraft */

public List<RaiderModel> GetRaiderList()
Expand Down

0 comments on commit 7e957c8

Please sign in to comment.