feat: implementado un patron de repository

This commit is contained in:
fede committed 2026-06-10 17:50:57 -03:00
1 parent 03df1c5264
commit 785bc7db6b
18 files changed
+505 -160

No files matched your search

+25
View File
@@ -21,3 +21,28 @@ type Grupo struct {
func (Grupo) TableName() string {
return "groups"
}
func (g *Grupo) Buscar(id uint) bool {
for _, permiso := range g.Permisos {
if permiso.Buscar(id) {
return true
}
}
for _, subGrupo := range g.Grupos {
if subGrupo.Buscar(id) {
return true
}
}
return false
}
func (g *Grupo) ListarPermisos() []Permiso {
var result []Permiso
for _, permiso := range g.Permisos {
result = append(result, permiso)
}
for _, subGrupo := range g.Grupos {
result = append(result, subGrupo.ListarPermisos()...)
}
return result
}