lots of fixes

This commit is contained in:
2024-04-07 19:51:58 -05:00
parent 7b0ac130f8
commit 2728d612d4
15 changed files with 55 additions and 203 deletions
+4 -3
View File
@@ -18,6 +18,7 @@ enum BusinessType {
shop,
outdoors,
manufacturing,
entertainment,
other,
}
@@ -216,7 +217,7 @@ void main() async {
try{
await File('logos/$id.png').delete();
} catch(e) {
print(e);
print('Failure to delete logo! $e');
}
return Response.ok(
@@ -248,7 +249,7 @@ void main() async {
await postgres.query(
'''
UPDATE businesses SET
name = '${business.name.replaceAll("'", "''")}'::text, description = '${business.description.replaceAll("'", "''")}'::text, website = '${business.website}'::text, type = '${business.type.name}'::text, "contactName" = '${business.contactName.replaceAll("'", "''")}'::text, "contactPhone" = '${business.contactPhone}'::text, "contactEmail" = '${business.contactEmail}'::text, notes = '${business.notes.replaceAll("'", "''")}'::text, "locationName" = '${business.locationName.replaceAll("'", "''")}'::text, "locationAddress" = '${business.locationAddress.replaceAll("'", "''")}'::text WHERE
name = '${business.name.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text, description = '${business.description.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text, website = '${business.website}'::text, type = '${business.type.name}'::text, "contactName" = '${business.contactName.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text, "contactPhone" = '${business.contactPhone}'::text, "contactEmail" = '${business.contactEmail}'::text, notes = '${business.notes.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text, "locationName" = '${business.locationName.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text, "locationAddress" = '${business.locationAddress.replaceAll("'", "''").replaceAll("\"", "\"\"")}'::text WHERE
id = ${business.id};
'''
);
@@ -260,7 +261,7 @@ void main() async {
try {
await File('logos/${business.id}.png').delete();
} catch(e) {
print(e);
print('Failure to delete logo! $e');
}
if (logoResponse.headers.toString().contains('image/png')) {
await File('logos/${business.id}.png').writeAsBytes(logoResponse.bodyBytes);