Add License Integration

This commit is contained in:
aditya.siregar
2024-08-02 00:51:54 +07:00
parent 5e26402c10
commit c1ae2fd14a
9 changed files with 92 additions and 29 deletions
+11
View File
@@ -84,3 +84,14 @@ func (r *LicenseRepository) GetAll(ctx context.Context, limit, offset int, statu
return licenses, total, nil
}
func (r *LicenseRepository) FindByPartnerIDMaxEndDate(ctx context.Context, partnerID *int64) (*entity.LicenseDB, error) {
var licenseDB entity.LicenseDB
if err := r.db.WithContext(ctx).
Where("partner_id = ?", partnerID).
Order("end_date DESC").
First(&licenseDB).Error; err != nil {
return nil, err
}
return &licenseDB, nil
}
+1
View File
@@ -205,6 +205,7 @@ type License interface {
Update(ctx context.Context, license *entity.LicenseDB) (*entity.LicenseDB, error)
FindByID(ctx context.Context, id string) (*entity.LicenseDB, error)
GetAll(ctx context.Context, limit, offset int, statusFilter string) ([]*entity.LicenseGetAll, int64, error)
FindByPartnerIDMaxEndDate(ctx context.Context, partnerID *int64) (*entity.LicenseDB, error)
}
type TransactionRepository interface {