Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c61e0e0
error de ruta
jeremiasVA Jun 2, 2025
2c03bba
Merge branch 'main' of https://github.com/Frosmin/Generacion-Software…
jeremiasVA Jun 19, 2025
fb78988
Merge branch 'main' into jeremias
jeremiasVA Jun 23, 2025
ddbc4f6
redirije a cursos al completar o cancelar Crear curso
jeremiasVA Jun 23, 2025
2b6b2fa
componente de formulario de curso separado
jeremiasVA Jun 23, 2025
74adeb9
campos de tiempo maximo y recursos maximos incluidos en el formulario…
jeremiasVA Jun 23, 2025
6c2c130
crear curso en el navbar con traducciones
jeremiasVA Jun 23, 2025
ff2bf78
editar curso front, carga el JSON en el form
jeremiasVA Jun 24, 2025
d4b59af
campos de espacio y tiempo maximo cambiado
jeremiasVA Jun 24, 2025
5be251f
Vista previa del JSON eliminado, solo era pa probar
jeremiasVA Jun 24, 2025
333ba6b
borra comentarion y console.log
jeremiasVA Jun 24, 2025
93d83bd
spec.ts para form-course
jeremiasVA Jun 24, 2025
b8726f2
spec.ts para create-course
jeremiasVA Jun 24, 2025
dbbf355
spec.ts para edit-course
jeremiasVA Jun 24, 2025
fa33c6e
boton de editar agregado en las cards de cursos
jeremiasVA Jun 24, 2025
20cde40
grid de cursos mejorao, cambienlo si no convence xd
jeremiasVA Jun 24, 2025
5159ae8
cambio spec.ts
jeremiasVA Jun 24, 2025
11d582a
Merge branch 'jeremias' of https://github.com/Frosmin/Generacion-Soft…
josuex123 Jun 24, 2025
2b360ad
fix: nuevas columnas agregadas a la db
josuex123 Jun 24, 2025
ca1ddcd
fix: ejemplos cursos ya muestra como deberia
josuex123 Jun 25, 2025
09ebabf
fix: cursos editables
josuex123 Jun 25, 2025
dc3781b
fix: pruebas unitarioas solucionado
josuex123 Jun 25, 2025
6011382
fix:time and memory
polycyllo Jun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions backend/models/Course.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
package models

import (
//"gorm.io/gorm"
"encoding/json"
"database/sql/driver"
)

type Course struct {
ID uint `json:"id" gorm:"primaryKey"`
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Goto string `json:"goto"`
Contents []Content `json:"contents" gorm:"foreignKey:CourseID"`
Contents []Content `json:"contents" gorm:"foreignKey:CourseID;constraint:OnDelete:CASCADE"`
}

type Content struct {
ID uint `json:"id" gorm:"primaryKey"`
CourseID uint `json:"-"`
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
CourseID uint `json:"-" gorm:"not null"`
Title string `json:"title"`
Paragraph GormStrings `json:"paragraph" gorm:"type:jsonb"`
Subcontent []Subcontent `json:"subcontent" gorm:"foreignKey:ContentID"`
Subcontent []Subcontent `json:"subcontent" gorm:"foreignKey:ContentID;constraint:OnDelete:CASCADE"`
Next string `json:"next,omitempty"`
MaxResourceConsumption int `json:"maxResourceConsumption"`
MaxProcessingTime int `json:"maxProcessingTime"`
}

type Subcontent struct {
ID uint `json:"id" gorm:"primaryKey"`
ContentID uint `json:"-"`
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
ContentID uint `json:"-" gorm:"not null"`
Subtitle string `json:"subtitle"`
Subparagraph GormStrings `json:"subparagraph" gorm:"type:jsonb"`
Example GormStrings `json:"example" gorm:"type:jsonb"`
Expand All @@ -35,6 +37,7 @@ type GormStrings []string
func (g GormStrings) Value() (driver.Value, error) {
return json.Marshal(g)
}

func (g *GormStrings) Scan(value interface{}) error {
return json.Unmarshal(value.([]byte), g)
}
2 changes: 2 additions & 0 deletions backend/routes/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ func SetupRouter() *gin.Engine {
api.GET("/courses/:id", GetCourse)
api.POST("/courses", CreateCourse)
api.GET("/course/:goto", GetCourseIDByGoto)
api.PUT("/courses/:id", UpdateCourse)
api.DELETE("/courses/:id", DeleteCourse)
return r
}
Loading
Loading