Skip to content

Commit 42ab508

Browse files
committed
doc: add comments to GetQuotesWithRetainedByStateAndDate methods
1 parent d57857a commit 42ab508

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

internal/adapters/dataproviders/database/mongo/pegin.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,21 @@ func (repo *peginMongoRepository) GetRetainedQuotesForAddress(ctx context.Contex
456456
return result, nil
457457
}
458458

459+
// GetQuotesWithRetainedByStateAndDate retrieves pegin quotes filtered by state and date range,
460+
// optionally joined with their retained data.
461+
//
462+
// IMPORTANT: This method may return quotes WITHOUT retained data (non-accepted quotes).
463+
// The aggregation pipeline includes quotes that have no matching RetainedPeginQuote
464+
// record. For these quotes, the RetainedQuote field will be a zero-valued struct:
465+
// - QuoteHash: "" (empty string)
466+
// - DepositAddress: ""
467+
// - State: ""
468+
// - All numeric fields: 0
469+
// - All Wei pointers: set to NewWei(0) by FillZeroValues()
470+
//
471+
// The states parameter filters by RetainedQuote state when retained data exists, or
472+
// includes quotes without retained data regardless of the provided states.
473+
//
459474
// TODO: add pagination to this method
460475
func (repo *peginMongoRepository) GetQuotesWithRetainedByStateAndDate(ctx context.Context, states []quote.PeginState, startDate, endDate time.Time) ([]quote.PeginQuoteWithRetained, error) {
461476
dbCtx, cancel := context.WithTimeout(ctx, repo.conn.timeout)

internal/adapters/dataproviders/database/mongo/pegout.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,20 @@ func (repo *pegoutMongoRepository) GetRetainedQuotesInBatch(ctx context.Context,
593593
return result, nil
594594
}
595595

596+
// GetQuotesWithRetainedByStateAndDate retrieves pegout quotes filtered by state and date range,
597+
// optionally joined with their retained data.
598+
//
599+
// IMPORTANT: This method may return quotes WITHOUT retained data (non-accepted quotes).
600+
// The aggregation pipeline includes quotes that have no matching RetainedPegoutQuote
601+
// record. For these quotes, the RetainedQuote field will be a zero-valued struct:
602+
// - QuoteHash: "" (empty string)
603+
// - DepositAddress: ""
604+
// - State: ""
605+
// - All numeric fields: 0
606+
// - All Wei pointers: set to NewWei(0)
607+
//
608+
// The states parameter filters by RetainedQuote state when retained data exists, or
609+
// includes quotes without retained data regardless of the provided states.
596610
func (repo *pegoutMongoRepository) GetQuotesWithRetainedByStateAndDate(ctx context.Context, states []quote.PegoutState, startDate, endDate time.Time) ([]quote.PegoutQuoteWithRetained, error) {
597611
dbCtx, cancel := context.WithTimeout(ctx, repo.conn.timeout)
598612
defer cancel()

0 commit comments

Comments
 (0)