-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sssomeshhh/phca
merge phca with trunk
- Loading branch information
Showing
26 changed files
with
1,328 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,35 @@ jobs: | |
tags: | | ||
sssomeshhh/rentify:fs | ||
sssomeshhh/rentify:fs-${{ github.sha }} | ||
rn: | ||
runs-on: ubuntu-22.04 | ||
needs: fs | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Login to Docker Hub | ||
uses: docker/[email protected] | ||
with: | ||
registry: docker.io | ||
username: sssomeshhh | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- name: Setup Docker Buildx | ||
id: setup_buildx | ||
uses: docker/[email protected] | ||
- name: Build Target | ||
uses: docker/[email protected] | ||
with: | ||
builder: ${{ steps.setup_buildx.name }} | ||
context: . | ||
file: Dockerfile | ||
target: rn | ||
cache-from: | | ||
type=registry,ref=sssomeshhh/cache:rentify-rn | ||
cache-to: | | ||
type=registry,ref=sssomeshhh/cache:rentify-rn | ||
load: false | ||
push: true | ||
tags: | | ||
sssomeshhh/rentify:rn | ||
sssomeshhh/rentify:rn-${{ github.sha }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,19 @@ | |
"dependencies": { | ||
"bcryptjs": "^2.4.3", | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.4.5", | ||
"express": "^4.19.2", | ||
"express-session": "^1.18.0", | ||
"jsonwebtoken": "^9.0.2", | ||
"mongoose": "^8.4.0" | ||
}, | ||
"devDependencies": { | ||
"nodemon": "^3.1.0" | ||
"nodemon": "^3.1.0", | ||
"webpack": "^5.91.0", | ||
"webpack-cli": "^5.1.4" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"develop": "nodemon src/index.js", | ||
"produce": "node src/index.js" | ||
"produce": "yarn webpack" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"main": "fs.cjs", | ||
"output": "fs.blob" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import {mng} from "./imports.js"; | ||
|
||
const connect = async () => { | ||
const connectDatabase = async () => { | ||
try { | ||
await mng.connect('mongodb://localhost:27017/', { dbName: "rentify" }); | ||
console.log('[serverApi] MongoDB connected'); | ||
console.log('[server] MongoDB connected'); | ||
} catch (err) { | ||
console.error(err.message); | ||
process.exit(1); | ||
} | ||
}; | ||
|
||
export { connect }; | ||
export { connectDatabase }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
import bcr from "bcryptjs"; | ||
import crs from "cors"; | ||
import cry from "crypto"; | ||
import env from "dotenv"; | ||
import exp from "express"; | ||
import jwt from "jsonwebtoken"; | ||
import mng from "mongoose"; | ||
import pth from "path"; | ||
import ses from "express-session"; | ||
import url from "url"; | ||
|
||
export { | ||
bcr, | ||
crs, | ||
cry, | ||
env, | ||
exp, | ||
jwt, | ||
mng, | ||
pth, | ||
ses, | ||
url | ||
mng | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import {bcr} from "./imports.js"; | ||
import { Property, User } from "./schemas.js"; | ||
|
||
const evalPopulate = async () => { | ||
let sellerId; | ||
await User.create({ | ||
firstName: 'Seller', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
phoneNumber: '97531', | ||
password: await bcr.hash('Seller.User.97531', 10), | ||
role: 'seller' | ||
}).then((seller) => { | ||
sellerId = seller._id.toString(); | ||
}); | ||
await User.create({ | ||
firstName: 'Buyer', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
phoneNumber: '86420', | ||
password: await bcr.hash('Buyer.User.86420', 10), | ||
role: 'buyer' | ||
}); | ||
await Property.create({ | ||
title: 'P1.Title', | ||
description: 'P1.Description', | ||
location: 'L.A', | ||
bedrooms: 1, | ||
bathrooms: 1, | ||
rent: 1000, | ||
seller: sellerId | ||
}); | ||
await Property.create({ | ||
title: 'P2.Title', | ||
description: 'P2.Description', | ||
location: 'L.B', | ||
bedrooms: 2, | ||
bathrooms: 2, | ||
rent: 2000, | ||
seller: sellerId | ||
}); | ||
await Property.create({ | ||
title: 'P3.Title', | ||
description: 'P3.Description', | ||
location: 'L.C', | ||
bedrooms: 3, | ||
bathrooms: 3, | ||
rent: 3000, | ||
seller: sellerId | ||
}); | ||
await Property.create({ | ||
title: 'P4.Title', | ||
description: 'P4.Description', | ||
location: 'L.D', | ||
bedrooms: 4, | ||
bathrooms: 4, | ||
rent: 4000, | ||
seller: sellerId | ||
}); | ||
await Property.create({ | ||
title: 'P5.Title', | ||
description: 'P5.Description', | ||
location: 'L.E', | ||
bedrooms: 5, | ||
bathrooms: 5, | ||
rent: 5000, | ||
seller: sellerId | ||
}); | ||
} | ||
|
||
export { evalPopulate }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { crs, exp } from "./imports.js"; | ||
|
||
import { connectDatabase } from "./database.js"; | ||
import { evalPopulate } from "./populate.js"; | ||
import { apiRouter } from "./routers.js"; | ||
|
||
const startServer = () => { | ||
const app = exp(); | ||
|
||
const isEval = process.env.IS_EVAL; | ||
|
||
const serverPort = process.env.SERVER_PORT; | ||
|
||
const staticDir = process.env.STATIC_DIR; | ||
|
||
app.use(crs()); | ||
app.use(exp.json()); | ||
|
||
app.use('/api', apiRouter); | ||
|
||
app.use((req, res, next) => { | ||
if (/(.ico|.js|.css|.jpg|.png|.map)$/i.test(req.path)) { | ||
next(); | ||
} else { | ||
res.header("Cache-Control", "private, no-cache, no-store, must-revalidate"); | ||
res.header("Expires", "-1"); | ||
res.header("Pragma", "no-cache"); | ||
res.sendFile(`${staticDir}/index.html`); | ||
} | ||
}); | ||
|
||
app.use(exp.static(staticDir)); | ||
|
||
app.get('/', (req, res) => { | ||
res.sendFile(`${staticDir}/index.html`) | ||
}); | ||
|
||
connectDatabase().then(() => { | ||
if (isEval === 'true') { | ||
evalPopulate().then(() => { | ||
console.log('[server] Populated database with sample data for evaluation'); | ||
}); | ||
} | ||
}); | ||
|
||
app.listen(serverPort, () => { | ||
console.log(`[server] Listening on port ${serverPort}`); | ||
}); | ||
}; | ||
|
||
export { startServer }; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.