only show approved services in attribute view

This commit is contained in:
pluja 2025-01-09 17:49:09 +01:00
parent 5319b602c0
commit 394b310c8c
No known key found for this signature in database

View File

@ -12,6 +12,7 @@ import (
"kycnot.me/internal/database"
"kycnot.me/internal/ent"
"kycnot.me/internal/ent/attribute"
"kycnot.me/internal/ent/service"
)
func Attribute(c iris.Context) {
@ -25,7 +26,9 @@ func Attribute(c iris.Context) {
aa, err := database.Client().Attribute.Query().
Where(attribute.SlugEQ(slug)).
Order(ent.Asc(attribute.FieldRating)).
WithServices().
WithServices(func(sq *ent.ServiceQuery) {
sq.Where(service.PendingEQ(false))
}).
First(context.Background())
if err != nil {
// Handle the error (e.g., service not found)