package mapper import ( "wm-backend/internal/models" db "wm-backend/sqlc_gen" "github.com/jackc/pgx/v5/pgtype" ) func ToDomainRoom(r db.Room) *models.Room { return &models.Room{ ID: r.ID, WarehouseID: r.WarehouseID, Name: r.Name, Description: r.Description.String, CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt, } } func ToModelRoom(r *models.Room) *db.CreateRoomParams { return &db.CreateRoomParams{ WarehouseID: r.WarehouseID, Name: r.Name, Description: pgtype.Text{ String: r.Description, Valid: r.Description != "", }, CreatedAt: r.CreatedAt, } } func ToUpdateModelRoom(r *models.Room) *db.UpdateRoomParams { return &db.UpdateRoomParams{ Name: r.Name, Description: pgtype.Text{ String: r.Description, Valid: r.Description != "", }, UpdatedAt: r.UpdatedAt, ID: r.ID, } }