feat (user): add sanitize to hide password for log

This commit is contained in:
dpurbosakti
2025-08-25 09:41:27 +07:00
parent 497d209456
commit 4d10a8f99f
2 changed files with 7 additions and 1 deletions
@@ -75,3 +75,9 @@ func ToResponseList(users []User) []ResponseDto {
}
return resp
}
func (c CreateDto) Sanitize() CreateDto {
sanitized := c
sanitized.Password = "[REDACTED]"
return sanitized
}
+1 -1
View File
@@ -24,7 +24,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
}
// Start log
pl.SetLogInfo(&event, input, "started", "create")
pl.SetLogInfo(&event, input.Sanitize(), "started", "create")
err := dg.I.Transaction(func(tx *gorm.DB) error {
mwRunner := newMiddlewareRunner(&event, tx)