mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 23:35:43 +00:00
FIX[BE] : fix project flock kandang get all API
This commit is contained in:
+6
-6
@@ -117,10 +117,10 @@ func (r *projectFlockKandangRepositoryImpl) GetAllWithFilters(ctx context.Contex
|
|||||||
AND "approvals"."approvable_type" = ?
|
AND "approvals"."approvable_type" = ?
|
||||||
AND LOWER("approvals"."step_name") = LOWER(?)
|
AND LOWER("approvals"."step_name") = LOWER(?)
|
||||||
AND "approvals"."id" IN (
|
AND "approvals"."id" IN (
|
||||||
SELECT "id" FROM "approvals"
|
SELECT "approvals"."id" FROM "approvals"
|
||||||
WHERE "approvable_id" = "project_flock_kandangs"."id"
|
WHERE "approvals"."approvable_id" = "project_flock_kandangs"."id"
|
||||||
AND "approvable_type" = ?
|
AND "approvals"."approvable_type" = ?
|
||||||
ORDER BY "action_at" DESC
|
ORDER BY "approvals"."id" DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -238,9 +238,9 @@ func (r *projectFlockKandangRepositoryImpl) GetByProjectFlockAndKandang(ctx cont
|
|||||||
func (r *projectFlockKandangRepositoryImpl) GetActiveByKandangID(ctx context.Context, kandangID uint) (*entity.ProjectFlockKandang, error) {
|
func (r *projectFlockKandangRepositoryImpl) GetActiveByKandangID(ctx context.Context, kandangID uint) (*entity.ProjectFlockKandang, error) {
|
||||||
latestApprovalSubQuery := r.db.
|
latestApprovalSubQuery := r.db.
|
||||||
Table("approvals").
|
Table("approvals").
|
||||||
Select("DISTINCT ON (approvable_id) approvable_id, step_name, action_at").
|
Select("DISTINCT ON (approvable_id) approvable_id, step_name, id").
|
||||||
Where("approvable_type = ?", "PROJECT_FLOCKS").
|
Where("approvable_type = ?", "PROJECT_FLOCKS").
|
||||||
Order("approvable_id, action_at DESC")
|
Order("approvable_id, id DESC")
|
||||||
|
|
||||||
var pfkID uint
|
var pfkID uint
|
||||||
if err := r.db.WithContext(ctx).
|
if err := r.db.WithContext(ctx).
|
||||||
|
|||||||
Reference in New Issue
Block a user