Skip to content

Commit

Permalink
chore: continue progress in fixing variable issue
Browse files Browse the repository at this point in the history
  • Loading branch information
anfibiacreativa authored and manekinekko committed Jan 25, 2023
1 parent d6a8b4e commit 4fd17f0
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 22 deletions.
90 changes: 84 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/api/get-listing-by-id/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import pg from 'pg';
export async function getListingById(context: any, req: any) {
try {
const client = new pg.Client({
user: process.env.POSTGRESQL_USER,
password: process.env.POSTGRESQL_PASSWORD,
host: process.env.POSTGRESQL_HOST,
port: Number(process.env.POSTGRESQL_PORT),
database: process.env.POSTGRESQL_DATABASE,
ssl: true
user: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
host: process.env.DATABASE_HOST,
port: Number(process.env.DATABASE_PORT),
database: process.env.DATABASE_NAME,
ssl: true
});
await client.connect();

Expand Down
16 changes: 9 additions & 7 deletions packages/api/get-listings/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import pg from 'pg';

export async function main(context: any, req: any) {
const connectionString = process.env['ConnectionStrings:cosmosdb'];
context.log(connectionString, '#####connection string');
try {
const client = new pg.Client({
user: process.env.POSTGRESQL_USER,
password: process.env.POSTGRESQL_PASSWORD,
host: process.env.POSTGRESQL_HOST,
port: Number(process.env.POSTGRESQL_PORT),
database: process.env.POSTGRESQL_DATABASE,
user: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
host: process.env.DATABASE_HOST,
port: Number(process.env.DATABASE_PORT),
database: process.env.DATABASE_NAME,
ssl: true
});
await client.connect();
Expand Down Expand Up @@ -43,10 +45,10 @@ export async function main(context: any, req: any) {
}

const result = await client.query(
`SELECT * FROM LISTING WHERE isFeatured = $1 LIMIT $2 OFFSET $3`,
`SELECT * FROM LISTING WHERE isfeatured = $1 LIMIT $2 OFFSET $3`,
[featured, limit, offset]
);
const listing = result.rows.map((row) => {
const listing = result.rows.map((row: any) => {
row.fees = row.fees.split('|');
row.photos = row.photos.split('|');
row.address = row.address.split('|');
Expand Down
2 changes: 1 addition & 1 deletion packages/api/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
"version": "3.0.0"
},
"extensions": {
"http": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@azure/functions": "^1.2.3",
"@faker-js/faker": "^7.5.0",
"@types/node": "^18.11.18",
"@types/pg": "^8.6.6",
"@types/swagger-ui-dist": "^3.30.1",
"@types/yamljs": "^0.2.31",
"@typescript-eslint/eslint-plugin": "^5.48.1",
Expand Down
2 changes: 1 addition & 1 deletion swa-cli.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"run": "npm start",
"appDevserverUrl": "http://localhost:4200",
"appName": "nv-contoso-portal-app",
"resourceGroup": "nv-contoso-portal-app-rg"
"resourceGroup": "nv-contoso-deployments"
}
}
}

0 comments on commit 4fd17f0

Please sign in to comment.