Skip to content

Commit fdffd9c

Browse files
committed
Upload complete API files of the project.
1 parent e88cecb commit fdffd9c

File tree

12 files changed

+2897
-0
lines changed

12 files changed

+2897
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,8 @@ dist
137137
# Vite logs files
138138
vite.config.js.timestamp-*
139139
vite.config.ts.timestamp-*
140+
141+
/src/generated/prisma
142+
143+
# .env files
144+
.env

package-lock.json

Lines changed: 2681 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "medsoft-api",
3+
"version": "1.0.0",
4+
"description": "Backend service for the Medsoft platform - A modular medical management system designed for clinics and small healthcare teams.",
5+
"main": "index.js",
6+
"scripts": {
7+
"dev": "ts-node-dev --respawn --transpile-only src/server.ts",
8+
"build": "tsc",
9+
"start": "node dist/server.js",
10+
"lint": "echo \"no linting yet\"",
11+
"test": "echo \"Error: no test specified\" && exit 1"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/kevinduncke/medsoft-api.git"
16+
},
17+
"keywords": [],
18+
"author": "",
19+
"license": "ISC",
20+
"type": "commonjs",
21+
"bugs": {
22+
"url": "https://github.com/kevinduncke/medsoft-api/issues"
23+
},
24+
"homepage": "https://github.com/kevinduncke/medsoft-api#readme",
25+
"dependencies": {
26+
"@prisma/client": "^7.3.0",
27+
"@types/cors": "^2.8.19",
28+
"@types/express": "^5.0.6",
29+
"@types/node": "^25.2.0",
30+
"cors": "^2.8.6",
31+
"dotenv": "^17.2.3",
32+
"express": "^5.2.1",
33+
"ts-node-dev": "^2.0.0"
34+
},
35+
"devDependencies": {
36+
"prisma": "^7.3.0",
37+
"typescript": "^5.9.3"
38+
}
39+
}

prisma.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file was generated by Prisma, and assumes you have installed the following:
2+
// npm install --save-dev prisma dotenv
3+
import "dotenv/config";
4+
import { defineConfig } from "prisma/config";
5+
6+
export default defineConfig({
7+
schema: "prisma/schema.prisma",
8+
migrations: {
9+
path: "prisma/migrations",
10+
},
11+
datasource: {
12+
url: process.env["DATABASE_URL"],
13+
},
14+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- CreateTable
2+
CREATE TABLE "User" (
3+
"id" TEXT NOT NULL,
4+
"email" TEXT NOT NULL,
5+
"password" TEXT NOT NULL,
6+
"role" TEXT NOT NULL,
7+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
8+
"updatedAt" TIMESTAMP(3) NOT NULL,
9+
10+
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
11+
);
12+
13+
-- CreateTable
14+
CREATE TABLE "Patient" (
15+
"id" TEXT NOT NULL,
16+
"firstName" TEXT NOT NULL,
17+
"lastName" TEXT NOT NULL,
18+
"email" TEXT,
19+
"phone" TEXT,
20+
"birthDate" TIMESTAMP(3),
21+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
22+
"updatedAt" TIMESTAMP(3) NOT NULL,
23+
24+
CONSTRAINT "Patient_pkey" PRIMARY KEY ("id")
25+
);
26+
27+
-- CreateIndex
28+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
29+
30+
-- CreateIndex
31+
CREATE UNIQUE INDEX "Patient_email_key" ON "Patient"("email");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (e.g., Git)
3+
provider = "postgresql"

prisma/schema.prisma

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
generator client {
2+
provider = "prisma-client"
3+
output = "../src/generated"
4+
}
5+
6+
datasource db {
7+
provider = "postgresql"
8+
}
9+
10+
model User {
11+
id String @id @default(cuid())
12+
email String @unique
13+
password String
14+
role String // 'admin' | 'doctor' | 'receptionist'
15+
createdAt DateTime @default(now())
16+
updatedAt DateTime @updatedAt
17+
}
18+
19+
model Patient {
20+
id String @id @default(cuid())
21+
firstName String
22+
lastName String
23+
email String? @unique
24+
phone String?
25+
birthDate DateTime?
26+
createdAt DateTime @default(now())
27+
updatedAt DateTime @updatedAt
28+
}

src/app.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import express from 'express';
2+
import cors from 'cors';
3+
import dotenv from 'dotenv';
4+
import { registerRoutes } from './routes';
5+
6+
dotenv.config();
7+
8+
export const createApp = () => {
9+
const app = express();
10+
11+
app.use(cors());
12+
app.use(express.json());
13+
14+
app.get('/health', (req, res) => {
15+
res.json({ status: 'ok', timestamp: new Date().toISOString() });
16+
});
17+
18+
registerRoutes(app);
19+
20+
return app;
21+
};

src/config/prisma.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { PrismaClient, PrismaClientOptions } from '../generated/prisma/client';
2+
3+
const prismaClientOptions: PrismaClientOptions = {
4+
log: ['query', 'info', 'warn', 'error'],
5+
};
6+
7+
if (process.env.PRISMA_ACCELERATE_URL) {
8+
prismaClientOptions.accelerateUrl = process.env.PRISMA_ACCELERATE_URL;
9+
}
10+
11+
export const prisma = new PrismaClient(prismaClientOptions);

src/routes/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Express } from 'express';
2+
3+
export const registerRoutes = (app: Express) => {
4+
// app.use('/auth', authRouter);
5+
// app.use('/patientes', patientsRouter);
6+
// etc..
7+
};

0 commit comments

Comments
 (0)