I have a nestjs api using typeorm and postgres where I need to query for any users that have the days 'Mo,Sa'. I am open to better ways of organizing the dayswillworkcolumn if a comma delimited string is not a good way to go about doing this.
userId | name | dayswillwork |
---|---|---|
1 | Joe | "Su,Mo,Tu" |
2 | Amber | "Fr,Sa,Su" |
3 | Craig | "Su,Tu,Th,Fr" |
4 | Steve | "Mo,Tu,We," |
I have tried...
query.where('employee.dayswillwork LIKE :days', {
days: days,
});
and...
query.where(":dayswillwork = ANY ( string_to_array(employee.dayswillwork , ','))", { dayswillwork : dayswillwork })
but neither one is returning anything.