@a_team/prisma 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// npx ts-node playground/contract.ts
|
|
2
|
+
|
|
3
|
+
import { PrismaClient } from "@prisma/client";
|
|
4
|
+
|
|
5
|
+
const prisma = new PrismaClient();
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const contract = await prisma.contract.findUnique({
|
|
9
|
+
where: { sid: "66cf64d100e0d700127facdf" },
|
|
10
|
+
include: {
|
|
11
|
+
mission: true,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
console.log(contract);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
main()
|
|
18
|
+
.then(async () => {
|
|
19
|
+
await prisma.$disconnect();
|
|
20
|
+
})
|
|
21
|
+
.catch(async (e) => {
|
|
22
|
+
console.error(e);
|
|
23
|
+
await prisma.$disconnect();
|
|
24
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// npx ts-node playground/contracts.ts
|
|
2
|
+
|
|
3
|
+
import { PrismaClient } from "@prisma/client";
|
|
4
|
+
|
|
5
|
+
const prisma = new PrismaClient();
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const contracts = await prisma.contract.findMany({
|
|
9
|
+
take: 5,
|
|
10
|
+
});
|
|
11
|
+
console.log(contracts);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
main()
|
|
15
|
+
.then(async () => {
|
|
16
|
+
await prisma.$disconnect();
|
|
17
|
+
})
|
|
18
|
+
.catch(async (e) => {
|
|
19
|
+
console.error(e);
|
|
20
|
+
await prisma.$disconnect();
|
|
21
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
model Contract {
|
|
2
|
+
sid String @id @default(auto()) @map("_id") @db.ObjectId
|
|
3
|
+
status ContractStatus
|
|
4
|
+
type ContractType
|
|
5
|
+
downloadURL String
|
|
6
|
+
createdAt DateTime @db.Date
|
|
7
|
+
updatedAt DateTime @updatedAt @db.Date
|
|
8
|
+
parties ContractParty[]
|
|
9
|
+
missionId String? @map("mission") @db.ObjectId
|
|
10
|
+
mission Mission? @relation(fields: [missionId], references: [mid])
|
|
11
|
+
role String? @db.ObjectId
|
|
12
|
+
custom Boolean?
|
|
13
|
+
|
|
14
|
+
@@index([type, missionId, role, createdAt], map: "type_1_mission_1_role_1_createdAt_-1")
|
|
15
|
+
@@index([parties.user, status, createdAt], map: "parties.user_1_status_1_createdAt_1")
|
|
16
|
+
@@map("contracts")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
enum ContractStatus {
|
|
20
|
+
Created
|
|
21
|
+
Completed
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
enum ContractType {
|
|
25
|
+
TermsOfService
|
|
26
|
+
MissionAgreement
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ContractParty {
|
|
30
|
+
type ContractPartyType
|
|
31
|
+
user String? @db.ObjectId
|
|
32
|
+
ip String?
|
|
33
|
+
signedAt DateTime? @db.Date
|
|
34
|
+
accountId String? @db.ObjectId
|
|
35
|
+
stripeClient String?
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
enum ContractPartyType {
|
|
39
|
+
BillingCustomer
|
|
40
|
+
MissionRole
|
|
41
|
+
}
|