Skip to content

Commit abcfbc9

Browse files
committed
add: company location feature
1 parent 741caa6 commit abcfbc9

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- AlterTable
2+
ALTER TABLE "companies" ADD COLUMN "address" TEXT,
3+
ADD COLUMN "latitude" DOUBLE PRECISION,
4+
ADD COLUMN "longitude" DOUBLE PRECISION;

apps/backend/prisma/schema.prisma

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ model Company {
3737
status String @default("Active") // only active
3838
logoUrl String? // path to logo file
3939
userId String? // can be null if not assigned to a user
40+
address String? // company address
41+
latitude Float? // latitude coordinate
42+
longitude Float? // longitude coordinate
4043
createdAt DateTime @default(now())
4144
updatedAt DateTime @updatedAt
4245

apps/backend/src/routes/companies.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ router.post("/", authenticateJWT, upload.single('logo'), async (req, res) => {
408408
// });
409409
// }
410410

411-
const { name, service, capital, status, ownerId } = req.body;
411+
const { name, service, capital, status, ownerId, address, latitude, longitude } = req.body;
412412
const logoFile = req.file;
413413

414414
// Generate logo URL if file was uploaded
@@ -429,6 +429,9 @@ router.post("/", authenticateJWT, upload.single('logo'), async (req, res) => {
429429
status: status || "Active",
430430
userId: userId, // Always set userId
431431
logoUrl: logoUrl,
432+
address: address || null,
433+
latitude: latitude ? parseFloat(latitude) : null,
434+
longitude: longitude ? parseFloat(longitude) : null,
432435
},
433436
include: {
434437
owner: {

0 commit comments

Comments
 (0)