Typescript If Array Length In Postgresql