feat: add endpoint and logic for retrieving top exported components, including SQL queries, models, and service integration
This commit is contained in:
@@ -125,3 +125,20 @@ func GetTransactionChartData(ctx context.Context, queries *db.Queries, startDate
|
||||
|
||||
return models.TransactionChartData{Items: items}, nil
|
||||
}
|
||||
|
||||
func GetTopExportedComponents(ctx context.Context, queries *db.Queries, startDate, endDate time.Time, warehouseID pgtype.Int8, limitCount int32) ([]models.TopExportedComponent, error) {
|
||||
results, err := queries.GetTopExportedComponents(ctx, db.GetTopExportedComponentsParams{
|
||||
StartDate: startDate,
|
||||
EndDate: endDate,
|
||||
WarehouseID: warehouseID,
|
||||
LimitCount: limitCount,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items := make([]models.TopExportedComponent, 0, len(results))
|
||||
for _, r := range results {
|
||||
items = append(items, mapper.ToDomainTopExportedComponent(r))
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user