-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.prisma
More file actions
69 lines (60 loc) · 2.09 KB
/
schema.prisma
File metadata and controls
69 lines (60 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("STARC_POSTGRES_PRISMA_URL") // Uses connection pooling
directUrl = env("STARC_POSTGRES_URL_NON_POOLING") // Uses direct connection
}
model Merchant {
id String @id @default(cuid())
slug String @unique // e.g. "starbucks", "tesla"
name String
description String?
walletAddress String // Circle Wallet ID or EVM Address
logoUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([slug])
paymentRequests PaymentRequest[]
}
model PaymentRequest {
id String @id @default(cuid())
merchantId String
merchant Merchant @relation(fields: [merchantId], references: [id])
amount Decimal @db.Decimal(18, 6)
currency String @default("USDC")
status String @default("PENDING") // PENDING, COMPLETED, FAILED
txHash String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([merchantId])
}
model Employee {
id String @id @default(cuid())
name String
walletAddress String @unique
position String?
payrollAmount Decimal @db.Decimal(18, 6) @default(0.25)
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
payrollReceipts PayrollReceipt[]
@@index([walletAddress])
@@index([active])
}
model PayrollReceipt {
id String @id @default(cuid())
employeeId String
employee Employee @relation(fields: [employeeId], references: [id])
amount Decimal @db.Decimal(18, 6)
currency String @default("USDC")
status String @default("PENDING") // PENDING, COMPLETED, FAILED
txHash String?
paidAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([employeeId])
@@index([status])
@@index([createdAt])
}