Alex Oviedo
11/16/2023, 3:17 PMclass DailySheet extends Sheet {
String status = 'Nuevo'
Date startDate
Date endingDate
String comment = ""
static hasMany = [ analyzes:DailySheetAnalysis,
tasks:Task,
machines:MachineDailySheet,
attendances:Attendance,
externalEvents:ExternalEvent]
static belongsTo = [workplace:Workplace]
static constraints = {
endingDate nullable:true
comment nullable:true,blank:true
status inList:['En proceso','Aceptado','Rechazado']
}
static mapping = {
comment sqlType:'text'
}
}
And there the Task code:
class Task {
String description
Date beginDate
Date endDate
static belongsTo = [sheet:DailySheet]
}
I save a DailySheet with 5 task and it works correctly, but I when modify the object and send it from the frontend, the DailySheet with 3 task (I removed 2 task in the frontend) the Tasks are not deleted in the database, there still the 5 tasks.
The frontend is developed in VueJS and send the object as JSON, there aren't problem:
const { status, data } = await thanatosApi.post('/dailySheet',{ dailySheet:dailySheet.value })
if(status === 200){
Notify.create({
timeout:1500,
message:'Registro guardado, subiendo fotos...',
actions:[{icon:'close',color:'white'}],
type:'positive'})
}