Browse Source

fix(server): Fix some SQL that was incompatible with postgres

Michael Bromley 6 years ago
parent
commit
f11567b807

+ 1 - 1
server/src/service/services/country.service.ts

@@ -88,7 +88,7 @@ export class CountryService {
         const addressesUsingCountry = await this.connection
             .getRepository(Address)
             .createQueryBuilder('address')
-            .where('address.countryId = :id', { id })
+            .where('address.country = :id', { id })
             .getCount();
 
         if (0 < addressesUsingCountry) {

+ 1 - 1
server/src/service/services/customer.service.ts

@@ -67,7 +67,7 @@ export class CustomerService {
             .createQueryBuilder('address')
             .leftJoinAndSelect('address.country', 'country')
             .leftJoinAndSelect('country.translations', 'countryTranslation')
-            .where('address.customerId = :id', { id: customerId })
+            .where('address.customer = :id', { id: customerId })
             .getMany()
             .then(addresses => {
                 addresses.forEach(address => {

+ 1 - 1
server/src/service/services/zone.service.ts

@@ -78,7 +78,7 @@ export class ZoneService implements OnModuleInit {
         const taxRatesUsingZone = await this.connection
             .getRepository(TaxRate)
             .createQueryBuilder('taxRate')
-            .where('taxRate.zoneId = :id', { id })
+            .where('taxRate.zone = :id', { id })
             .getMany();
 
         if (0 < taxRatesUsingZone.length) {