|
|
@@ -34,17 +34,17 @@ func (cr APIContractRepository) Insert(ctx context.Context, conf models.APIContr
|
|
|
|
|
|
// List returns a list of api contract revisions sorted by created date for a given projectID.
|
|
|
// If clusterID is not specified (set to 0), this will return all revisions for a given project
|
|
|
-func (cr APIContractRepository) List(ctx context.Context, projectID uint, clusterID uint) ([]models.APIContractRevision, error) {
|
|
|
- var confs []models.APIContractRevision
|
|
|
+func (cr APIContractRepository) List(ctx context.Context, projectID uint, clusterID uint) ([]*models.APIContractRevision, error) {
|
|
|
+ var confs []*models.APIContractRevision
|
|
|
|
|
|
if clusterID == 0 {
|
|
|
- tx := cr.db.Preload("api_contract_revisions").Where("project_id = ?", projectID, clusterID).Order("created_at").Find(&confs)
|
|
|
+ tx := cr.db.Where("project_id = ?", projectID).Find(&confs)
|
|
|
if tx.Error != nil {
|
|
|
return nil, tx.Error
|
|
|
}
|
|
|
return confs, nil
|
|
|
}
|
|
|
- tx := cr.db.Preload("api_contract_revisions").Where("project_id = ? and cluster_id = ?", projectID, clusterID).Order("created_at").Find(&confs)
|
|
|
+ tx := cr.db.Where("project_id = ? and cluster_id = ?", projectID, clusterID).Find(&confs)
|
|
|
if tx.Error != nil {
|
|
|
return nil, tx.Error
|
|
|
}
|