test fixes

This commit is contained in:
Hayden 2023-01-27 14:07:13 -09:00
parent f1f455f8aa
commit ad6115770d
No known key found for this signature in database
GPG key ID: 17CF79474E257545
2 changed files with 3 additions and 2 deletions

View file

@ -356,7 +356,6 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Ite
} }
// QueryByAssetID returns items by asset ID. If the item does not exist, an error is returned. // QueryByAssetID returns items by asset ID. If the item does not exist, an error is returned.
func (e *ItemsRepository) QueryByAssetID(ctx context.Context, gid uuid.UUID, assetID AssetID, page int, pageSize int) (PaginationResult[ItemSummary], error) { func (e *ItemsRepository) QueryByAssetID(ctx context.Context, gid uuid.UUID, assetID AssetID, page int, pageSize int) (PaginationResult[ItemSummary], error) {
qb := e.db.Item.Query().Where( qb := e.db.Item.Query().Where(
@ -372,7 +371,7 @@ func (e *ItemsRepository) QueryByAssetID(ctx context.Context, gid uuid.UUID, ass
pageSize = -1 pageSize = -1
} }
items, err := mapItemsSummaryErr( items, err := mapItemsSummaryErr(
qb.Order(ent.Asc(item.FieldName)). qb.Order(ent.Asc(item.FieldName)).
WithLabel(). WithLabel().
WithLocation(). WithLocation().

View file

@ -36,6 +36,8 @@ func useItems(t *testing.T, len int) []ItemOut {
for _, item := range items { for _, item := range items {
_ = tRepos.Items.Delete(context.Background(), item.ID) _ = tRepos.Items.Delete(context.Background(), item.ID)
} }
_ = tRepos.Locations.Delete(context.Background(), location.ID)
}) })
return items return items