Created
May 24, 2022 06:29
-
-
Save LawJolla/1d93f3099d390ef71087d6ed19b88416 to your computer and use it in GitHub Desktop.
Prisma 1 datamodel
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
enum onDelete { | |
CASCADE | |
SET_NULL | |
} | |
type defaultArray { | |
id: ID! @id | |
value: [String] @scalarList(strategy: RELATION) | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
} | |
type defaultString { | |
id: ID! @id | |
value: String! | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
} | |
type User { | |
id: ID! @id | |
email: String | |
name: String | |
phone: String | |
identity: String | |
avatar: String | |
auth0id: String @unique | |
deals: [Deal] | |
permissions: [Permission] | |
devices: [Device] | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
addresses: [Address] | |
phoneNumbers: [PhoneNumber] | |
emailAddresses: [EmailAddress] | |
docs: [Doc] | |
signers: [Signer] | |
files: [File] | |
meta: Json | |
dealership: Dealership @relation(name: "DealershipCustomers") | |
worksFor: Dealership @relation(name: "DealershipWorksFor") | |
licensePlateLog: [DealerLicensePlateLog] @relation( name: "DealerLicensePlateLogUser") | |
driverLicense: DriverLicense | |
tasks: [Task] @relation(name: "UserTask", onDelete: SET_NULL) | |
notes: [Note] | |
notifications: [InAppNotification] | |
notificationSubscriptions: [UserNotificationPreference!] | |
dummyString: String | |
savedVehicleSearches: [CustomerVehicleSearch] | |
emailSubscribers: [EmailSubscriber] | |
plaidAccounts: [CustomerPlaidAccount] | |
physicalAccess: [PhysicalAccess] | |
} | |
type Date { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
date: DateTime! | |
label: String! | |
isUpcoming: Boolean! @default(value: false) | |
isForDealership: Boolean! @default(value: false) | |
deal: Deal @relation(link: INLINE) | |
action: DealAction @relation(link: INLINE) | |
dateType: String | |
} | |
type Signer { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
signatureFiles: [File] @relation(name: "SignatureFiles") | |
name: String! | |
registerName: String | |
user: User @relation(link: INLINE) | |
usedToSign: [SignedDoc] @relation(name: "SignerSignedDoc", onDelete: SET_NULL) | |
deals: [Deal] @relation(name: "DealSigner", onDelete: SET_NULL) | |
docs: [Doc] | |
signerTags: [SignerTagEnum] @scalarList(strategy: RELATION) | |
electronicConsent: ElectronicSignatureConsent @relation(link: INLINE, name: "ElectronicSigner", onDelete: CASCADE) | |
} | |
type ElectronicSignatureConsent { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
ip: String | |
# deal: Deal! @relation(link: INLINE, name: "ElectronicConsent") Not sure that we need this relation | |
signer: Signer! @relation(name: "ElectronicSigner") | |
} | |
type SignerTag { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
tag: SignerTagEnum | |
signer: Signer @relation(link: INLINE, name: "SignerTag") | |
} | |
type SignedDoc { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
signer: Signer! @relation(name: "SignerSignedDoc", onDelete: SET_NULL) | |
ip: String | |
doc: Doc! @relation(link: INLINE, name: "SignedDoc") | |
docSignatureId: String! | |
} | |
type EmailAddress { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String | |
email: String! | |
user: User @relation(link: INLINE) | |
deals: [Deal] | |
emailType: [EmailTypeEnum] @default(value: Current) @scalarList(strategy: RELATION) | |
emailOwnerEnum: OwnerEnum! @default(value: Buyer) | |
} | |
type PhoneNumber { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
phoneNumber: String! | |
contactName: String | |
businessName: String | |
phoneNumberOwnerEnum: OwnerEnum! @default(value: Buyer) | |
phoneNumberType: PhoneNumberTypeEnum! @default(value: Mobile) | |
mobileCarrier: String | |
country: String @default(value: "USA") | |
user: User @relation(link: INLINE) | |
vendor: Vendor @relation(link: INLINE) | |
deals: [Deal] | |
physicalAccess: [PhysicalAccess] | |
} | |
type Device { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
uuid: String @unique | |
userAgent: String | |
IP: String | |
users: [User] | |
# deals: [Deal] | |
} | |
type Permission { | |
id: ID! @id | |
role: RolesEnum! @default(value: LEAD) | |
dealership: Dealership! @relation(link: INLINE) | |
user: User! @relation(link: INLINE) | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
} | |
type Dealership { | |
id: ID! @id | |
name: String! @unique | |
phone: String | |
email: String @unique | |
slug: String! @unique | |
host: String @unique | |
isActive: Boolean! @default(value: true) | |
state: StateEnum! @default(value: AZ) | |
user: [Permission] | |
deals: [Deal] | |
vehicles: [Vehicle] | |
stores: [Store] | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
files: [File] | |
docs: [Doc] | |
vendors: [Vendor] | |
accounts: [DealerAccount] | |
transactions: [AccountTransaction] | |
allowedTransactionTypes: [TransactionTypeAllowedList] | |
plaidAccounts: [PlaidAccount] | |
actions: [DealAction] @relation(name: "DealershipActions") | |
addOns: [DealAddOn] | |
lineItems: [DealLineItem] @relation(name: "DealershipLineItems") | |
dealershipFloorPlans: [DealershipFloorPlan] | |
customerPayment: Json | |
licensePlates: [DealerLicensePlate!] | |
licensePlateLogs: [DealerLicensePlateLog!] | |
licensePlateUsers: [DealerLicensePlateUser!] | |
workers: [User] @relation(name: "DealershipWorksFor") | |
customers: [User] @relation(name: "DealershipCustomers") | |
tasks: [Task] @relation(name: "DealershipDealTask", onDelete: CASCADE) | |
notes: [Note] | |
emailSubscribers: [EmailSubscriber] @relation(name: "DealerEmailSubscriber", onDelete: CASCADE) | |
webUpdates: [WebUpdate] @relation(name: "DealerWebUpdate", onDelete: CASCADE) | |
siteBanners: [SiteBanner] @relation(name: "DealerSiteBanners", onDelete: CASCADE) | |
# dealFees: [DealLineItem] @relation(name: "DealershipDealFees", onDelete: CASCADE) | |
facebookAdGroups: [FacebookAdGroup] | |
integrations: [DealershipIntegration] @relation(name: "DealershipIntegration") | |
} | |
type SiteBanner { | |
id: ID! @id | |
dealership: Dealership! @relation(name: "DealerSiteBanners", onDelete: SET_NULL) | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
text: String! | |
link: String | |
allowClose: Boolean @default(value: true) | |
startAt: DateTime! | |
stopAt: DateTime! | |
colorScheme: ColorSchemeEnum! @default(value: BRAND) | |
} | |
type Store { | |
id: ID! @id | |
slug: String! @unique | |
dealership: Dealership @relation(link: INLINE) | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String! | |
publicName: String | |
legalName: String | |
street: String | |
city: String | |
state: String | |
zip: String | |
phone: String | |
internalName: String | |
isActive: Boolean! @default(value: true) | |
vehicles: [Vehicle] | |
vehicleTaxPolicies: [VehicleTaxPolicy] | |
deals: [Deal] | |
docs: [Doc] | |
files: [File] | |
actions: [DealAction] | |
addOns: [DealAddOn] | |
licensePlates: [DealerLicensePlate!] | |
licensePlateLog: [DealerLicensePlateLog!] | |
tasks: [Task] @relation(name: "DealStoreTask", onDelete: CASCADE) | |
# dealFees: [DealLineItem] @relation(name: "StoreDealFees", onDelete: CASCADE) | |
} | |
type Address { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
street: String | |
city: String | |
state: StateEnum | |
zip: String | |
addressType: [AddressTypeEnum] @default(value: Shipping) @scalarList(strategy: RELATION) | |
isCurrent: Boolean! @default(value: true) | |
user: User @relation(link: INLINE) | |
deals: [Deal] | |
vendor: Vendor @relation(link: INLINE) | |
} | |
type VehiclePrice { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
price: Int! | |
user: User @relation(link: INLINE) | |
vehicle: Vehicle @relation(link: INLINE, name: "VehiclePrices") | |
startDate: DateTime | |
endDate: DateTime | |
priceType: VehiclePriceTypeEnum! | |
} | |
type VehicleVideo { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
raw: String | |
high: String | |
medium: String | |
low: String | |
embed: String | |
label: String | |
vehicle: Vehicle @relation(link: INLINE, name: "VehicleVideos") | |
videoType: [VehicleVideoTypeEnum] @scalarList(strategy: RELATION) | |
} | |
type Disclosure { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
headline: String! | |
text: String! | |
component: String | |
showInDocs: Boolean! @defaut(value: false) | |
} | |
type Vehicle { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership @relation(link: INLINE) | |
store: Store @relation(link: INLINE) | |
stockNo: String! | |
year: Int! | |
make: String! | |
model: String | |
trim: String @default(value: "") | |
trim2: String @default(value: "") | |
image: String | |
vin: String @default(value: "00000000000000000") | |
fuel: FuelEnum @default(value: Gas) | |
color: String | |
tempColor: String | |
tempVehicleBoughtFrom: String | |
tempVehicleBoughtFromLocation: String | |
sentIsOnlineNotification: Boolean! @default(value: false) | |
tempVehicleBoughtFromType: VehicleBoughtFromEnum @default(value: Auction) | |
titleHistoryTags: [TitleHistoryEnum] @scalarList(strategy: RELATION) | |
disclosures: [Disclosure] @scalarList(name: "VehicleDisclosures", onDelete: CASCADE) | |
transmission: TransmissionEnum @default(value: Auto) | |
driveline: DrivelineEnum @default(value: RWD) | |
title: VehicleTitleEnum @default(value: Clean) | |
mileageStatus: VehicleMileageEnum @default(value: Actual) | |
mileage: Int @default(value: 0) | |
status: VehicleStatusEnum! @default(value: Not_Delivered) | |
videos: [VehicleVideo] @relation(name: "VehicleVideos", onDelete: CASCADE) | |
prices: [VehiclePrice] @relation(name: "VehiclePrices", onDelete: CASCADE) | |
dates: [VehicleDates] @relation(name: "VehicleDates", onDelete: CASCADE) | |
deals: [Deal] | |
docs: [Doc] | |
vehicleOptions: [VehicleOption] @relation(name: "VehicleToVehicleOptions", onDelete: CASCADE) | |
recon: [VehicleRecon] @relation(name: "VehicleRecon", onDelete: CASCADE) | |
vehicleBoughtFrom: VehicleBoughtFrom @relation(link: INLINE, name: "VehicleBoughtFrom") | |
vehicleTypes: [VehicleTypeEnum] @scalarList(strategy: RELATION) | |
files: [File] | |
actions: [DealAction] @relation(name: "VehicleDealAction", onDelete: CASCADE) | |
addOns: [DealAddOn] @relation(name: "AddOnVehicle", onDelete: CASCADE) | |
floorPlans: [FloorPlan] | |
plateLog: [DealerLicensePlateLog!] @relation( name: "DealerLicensePlateLogVehicle") | |
kbbOptions: Json | |
images: [VehicleImage!] @relation(onDelete: CASCADE) | |
tasks: [Task] @relation(name: "VehicleTask", onDelete: CASCADE) | |
dealFees: [DealLineItem] @relation(name: "VehicleDealFees", onDelete: CASCADE) | |
notes: [Note] | |
advertising: Advertising @relation(link: INLINE, onDelete: CASCADE) | |
} | |
type FacebookAdGroup { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
adGroup: String | |
dealership: Dealership! | |
} | |
type Advertising { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
facebook: FacebookAd @relation(link: INLINE, onDelete: CASCADE) | |
vehicle: Vehicle! | |
} | |
type FacebookAd { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
adGroups: [String] @scalarList(strategy: RELATION) | |
isActive: Boolean! @default(value: true) | |
advertising: Advertising! | |
} | |
type VehicleImage { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
url: String! | |
originalUrl: String! | |
description: String | |
order: Int @default(value: 0) | |
access: [RolesEnum!] @scalarList(strategy: RELATION) | |
vehicle: Vehicle! @relation( onDelete: SET_NULL) | |
tags: [VehicleImageTag] @relation( name: "VehicleImageTag", onDelete: CASCADE) | |
} | |
type VehicleImageTag { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
tag: VehicleImageTagEnum! | |
image: VehicleImage! @relation( name: "VehicleImageTag", onDelete: SET_NULL) | |
} | |
type VehicleDates { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
vehicle: Vehicle @relation(link: INLINE, name: "VehicleDates", onDelete: SET_NULL) | |
date: DateTime! | |
dateType: VehicleDateTypeEnum! | |
} | |
type VehicleBoughtFrom { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
vehicle: Vehicle! @relation(name: "VehicleBoughtFrom") | |
vendor: Vendor! @relation(link: INLINE) | |
address: Address! @relation(link: INLINE) | |
vehicleBoughtFromType: VehicleBoughtFromEnum! @default(value: Auction) | |
} | |
#Dealer bank account | |
type DealerAccount { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership! @relation(link: INLINE) | |
institutionName: String! | |
accountName: String! | |
accountType: AccountTypeEnum! | |
dealershipsNameForThisAccount: String | |
lastFour: String | |
available: Int! | |
limit: Int | |
transactions: [AccountTransaction] | |
permissions: [RolesEnum] @scalarList(strategy: RELATION) | |
plaid: PlaidAccount @relation(link: INLINE) | |
checks: [AccountCheck] @relation(name: "CheckingAccount", onDelete: CASCADE) | |
} | |
type PlaidAccount { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
accessToken: String! | |
dealerAccount: DealerAccount! | |
accountId: String! @unique | |
itemId: String | |
name: String! | |
type: String | |
subtype: String | |
officialName: String | |
dealership: Dealership! @relation(link: INLINE) | |
} | |
type AccountTransaction { | |
id: ID! @id | |
pending: Boolean! @default(value: true) | |
uniqueTransactionId: String! @unique | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
transactionDate: DateTime! | |
dealership: Dealership! @relation(link: INLINE) | |
account: DealerAccount! @relation(link: INLINE) | |
dealLineItems: [DealLineItem] | |
amount: Int! | |
ledgerDescription: String | |
description: String | |
items: [TransactionItem] @relation(name: "AccountTransactionItems", onDelete: CASCADE) | |
chargedBy: String | |
check: AccountCheck @relation(name: "AccountTransactionCheck", link: INLINE) | |
} | |
type AccountCheck { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
issuedDate: DateTime | |
memo: String | |
issuedBy: String! | |
voidedBy: String | |
voidDate: DateTime | |
checkNumber: String! | |
amount: Int! | |
cachedDate: DateTime | |
items: [TransactionItem] @relation(name: "AccountTransactionItemsToCheck", onDelete: CASCADE) | |
accountTransaction: AccountTransaction @relation(name: "AccountTransactionCheck") | |
account: DealerAccount! @relation(name: "CheckingAccount", onDelete: SET_NULL) | |
} | |
type VehicleRecon { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
bankLink: TransactionItem @relation(link: INLINE, name: "VehicleReconTransactionItem") | |
chargedDate: DateTime! | |
type: String | |
accountingType: String | |
vendorName: String | |
vendor: Vendor @relation(link: INLINE) | |
amount: Int! | |
description: String | |
vehicle: Vehicle @relation(link: INLINE, name: "VehicleRecon") | |
} | |
type TransactionTypeAllowedList { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership! @relation(link: INLINE) | |
name: String! | |
isReconType: Boolean! @default(value: true) | |
} | |
type BridgeAccountTransactionToTransactionItem { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
searchString: String! | |
accountingType: String! | |
vendor: Vendor! | |
dealership: Dealership! | |
} | |
type TransactionItem { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
vendor: Vendor! @relation(link: INLINE) | |
accountingType: String! | |
description: String! | |
dealership: Dealership! @relation(link: INLINE) | |
vehicleRecon: VehicleRecon @relation(name: "VehicleReconTransactionItem", onDelete: CASCADE) | |
amount: Int! | |
belongsTo: [RolesEnum] @scalarList(strategy: RELATION) | |
accountTransaction: AccountTransaction @relation(link: INLINE, name: "AccountTransactionItems", onDelete: SET_NULL) | |
check: AccountCheck @relation(link: INLINE, name: "AccountTransactionItemsToCheck" onDelete: SET_NULL) | |
} | |
type Vendor { | |
id: ID! @id | |
dealership: Dealership! @relation(link: INLINE) | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
recon: [VehicleRecon] | |
defaultAccountingType: String | |
defaultTransactionItemBelongsTo: [RolesEnum] @scalarList(strategy: RELATION) | |
transactions: [TransactionItem] | |
name: String! | |
addresses: [Address] | |
phoneNumbers: [PhoneNumber] | |
email: String | |
contactName: String | |
bridgeToAccountTransactions: [BridgeAccountTransactionToTransactionItem] | |
} | |
type VehicleOption { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
vehicle: Vehicle @relation(link: INLINE, name: "VehicleToVehicleOptions") | |
option: String! | |
hasOption: Boolean! @default(value: true) | |
vehicleOptionTags: [VehicleOptionTag] @relation(name: "VehicleOptionToVehicleOptionTag", onDelete: CASCADE) | |
} | |
type VehicleOptionTag { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
tag: VehicleOptionTagEnum! | |
vehicleOption: VehicleOption! @relation(link: INLINE, name: "VehicleOptionToVehicleOptionTag", onDelete: SET_NULL) | |
} | |
type DealAddOn { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
title: String | |
estimatedCompletionTime: String | |
benefits: [String] @scalarList(strategy: RELATION) | |
images: [String] @scalarList(strategy: RELATION) | |
#below is old and might be able to be deleted | |
persistOnDeal: Boolean @default(value: false) | |
dealership: Dealership @relation(link: INLINE) | |
onePerDeal: Boolean @default(value: false) | |
label: String! | |
docs: [Doc] | |
customerComponent: String | |
description: String | |
addToDeal: Boolean @default(value: false) | |
isAccepted: Boolean @default(value: false) | |
isAcceptedDate: DateTime | |
lineItems: [DealLineItem] @relation(name: "DealAddOnLineItems", onDelete: CASCADE) | |
isRequired: Boolean @default(value: false) | |
store: Store @relation(link: INLINE) | |
inheritsFrom: DealAddOn @relation(link: INLINE) | |
isDefault: Boolean @default(value: false) | |
deal: Deal @relation(link: INLINE, name: "DealAddOns") | |
actions: [DealAction] @relation(name: "DealAddOnActions" , onDelete: CASCADE) | |
tasks: [Task] @relation(name: "DealAddOnTask", onDelete: CASCADE) | |
vehicle: Vehicle @relation(link: INLINE, name: "AddOnVehicle") | |
conditionals: Json | |
addedBy: DealAddOnAddedByEnum | |
} | |
type Deal { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
dealType: DealTypeEnum @default(value: RETAIL) | |
deliveryType: DealDeliveryType @default(value: Pickup) | |
registeringStateEnum: StateEnum! | |
updatedAt: DateTime! @updatedAt | |
# device: Device @relation(link: INLINE) | |
isUserOnboarded: Boolean! @default(value: false) | |
questions: Json | |
dates: [Date] @relation( onDelete: CASCADE) | |
vehicles: [Vehicle] | |
users: [User] | |
trades: [Trade] | |
offers: [Offer] @relation(name: "DealOffer", onDelete: CASCADE) | |
offerStatus: OfferTypeEnum | |
dealership: Dealership! @relation(link: INLINE) | |
store: Store! @relation(link: INLINE) | |
status: DealStatusEnum @default(value: Offer) | |
lineItems: [DealLineItem] @relation(name: "DealLineItem", onDelete: CASCADE) | |
actions: [DealAction] @relation(name: "DealAction", onDelete: CASCADE) | |
signers: [Signer] @relation(name: "DealSigner", onDelete: CASCADE) | |
addresses: [Address] @relation(onDelete: CASCADE) | |
phoneNumbers: [PhoneNumber] @relation(onDelete: CASCADE) | |
emailAddresses: [EmailAddress] @relation(onDelete: CASCADE) | |
docs: [Doc] @relation(name: "DealDoc", onDelete: CASCADE) | |
# electronicSignatureConsents: [ElectronicSignatureConsent] @relation(name: "ElectronicConsent") #Not sure we need this relation | |
addOns: [DealAddOn] @relation(name: "DealAddOns", onDelete: CASCADE) | |
files: [File] | |
automatedMessages: [AutomatedMessage] @relation(name: "DealAutomatedMessage", onDelete: CASCADE) | |
tasks: [Task] @relation(name: "DealTask", onDelete: CASCADE) | |
notes: [Note] | |
} | |
type AutomatedMessage { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
messageType: String! #reponseReminder, responseMade, etc | |
sentBy: String #what method/service sent it | |
messageId: String #where its stored | |
deal: Deal! @relation(name: "DealAutomatedMessage", onDelete: SET_NULL) | |
} | |
type Doc { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
docType: DocTypeEnum! @default(value: SIGN) | |
docIsFor: DocIsForEnum! @default(value: DEAL) | |
deal: Deal @relation(link: INLINE, name: "DealDoc") | |
dealership: Dealership @relation(link: INLINE) | |
store: Store @relation(link: INLINE) | |
users: [User] | |
vehicle: Vehicle @relation(link: INLINE) | |
label: String! | |
# access: [RolesEnum] @scalarList(strategy: RELATION) | |
# originalFile: File @relation(link: INLINE, name: "DocFile") | |
canElectronicallySign: Boolean @default(value: true) | |
component: String | |
additionalContent: String | |
completedFile: File @relation(link: INLINE, name: "CompletedDocFile") | |
signed: [SignedDoc] @relation(name: "SignedDoc", onDelete: CASCADE ) | |
signers: [Signer] | |
inheritsFrom: Doc @relation(link: INLINE) | |
isDefault: Boolean @default(value: false) | |
meta: Json | |
} | |
type File { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
Key: String @unique | |
displayName: String! | |
internalName: String | |
Bucket: String | |
description: String | |
fileType: FileTypeEnum! | |
dealership: Dealership! @relation(link: INLINE) | |
access: [RolesEnum] @scalarList(strategy: RELATION) | |
# docs: [Doc] @relation(name: "DocFile") | |
completedFile: Doc @relation(name: "CompletedDocFile") | |
signer: Signer @relation(link: INLINE, name: "SignatureFiles") | |
tags: [FileTagEnum] @scalarList(strategy: RELATION) | |
meta: Json | |
vehicle: Vehicle @relation(link: INLINE) | |
user: User @relation(link: INLINE) | |
deal: Deal @relation(link: INLINE) | |
store: Store @relation(link: INLINE) | |
} | |
type DealAction { | |
id: ID! @id | |
deal: Deal @relation(link: INLINE, name: "DealAction") | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
lineItems: [DealLineItem] @relation(name: "DealActionLineItems") | |
label: String! | |
description: String | |
customerDescription: String | |
actionType: DealActionTypeEnum! | |
isInternal: Boolean @default(value: false) | |
isVisible: Boolean @default(value: true) | |
isActionable: Boolean @default(value: false) | |
isComplete: Boolean @default(value: false) | |
isDefault: Boolean @default(value: false) | |
completedDate: DateTime #depricated | |
timeToComplete: DateTime #depricated | |
dates: [Date] | |
actionFor: [DealActionForEnum] @scalarList(strategy: RELATION) | |
showOn: [DealStatusEnum] @scalarList(strategy: RELATION) | |
completedOn: [DealStatusEnum] @scalarList(strategy: RELATION) | |
# component: String! | |
meta: Json | |
userView: UserViewEnum! | |
noDealDuplicates: Boolean @default(value: false) | |
inheritsFrom: DealAction @relation(link: INLINE) | |
sideEffects: [SideEffectsEnum] @scalarList(strategy: RELATION) | |
store: Store @relation(link: INLINE) | |
addOn: DealAddOn @relation(link: INLINE, name: "DealAddOnActions") | |
dealership: Dealership @relation(link: INLINE, name: "DealershipActions") | |
vehicle: Vehicle @relation(link: INLINE, name: "VehicleDealAction") | |
} | |
type DealLineItem { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
amount: Int! | |
conditionals: Json | |
modifyBaseAmount: Json | |
ledgerType: LedgerTypeEnum! | |
label: String! | |
store: Store @relation(link: INLINE, name: "StoreLineItems") | |
dealership: Dealership @relation(link: INLINE, name: "DealershipLineItems") | |
deal: Deal @relation(link: INLINE, name: "DealLineItem", onDelete: SET_NULL) | |
isTaxable: Boolean @default(value: true) | |
allowCreditCardPayment: Boolean @default(value: false) | |
lineItemType: DealLineItemTypeEnum | |
action: DealAction @relation(link: INLINE, name: "DealActionLineItems") | |
task: Task @relation(link: INLINE, name: "DealTaskLineItems") | |
transaction: AccountTransaction @relation(link: INLINE) | |
excludeFrom: [String] @scalarList(strategy: RELATION) # when deal line Item should be $0 -- meta field | |
meta: Json | |
persistOnDeal: Boolean @default(value: false) | |
limitOnePerDeal: Boolean @default(value: false) | |
# dealershipFee: Dealership @relation(link: INLINE, name: "DealershipDealFees") | |
# storeFee: Store @relation(link: INLINE, name: "StoreDealFees") | |
vehicleFee: Vehicle @relation(link: INLINE, name: "VehicleDealFees") | |
inheritsFrom: DealLineItem @relation(link: INLINE) # needed to dedupe nested responses | |
} | |
type Offer { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
deal: Deal @relation(link: INLINE, name: "DealOffer") | |
type: OfferTypeEnum! | |
amount: Int! | |
} | |
type Trade { | |
id: ID! @id | |
year: Int! | |
make: String! | |
model: String | |
vin: String | |
tradeValue: Int! | |
deals: [Deal] | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
} | |
type VehicleTaxPolicy { | |
id: ID! @id | |
store: Store! @relation(link: INLINE) | |
type: TaxTypeEnum! | |
name: String! | |
displayName: String! | |
formula: String | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
} | |
type FloorPlan { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
floorPlanId: String! | |
floorPlanStockNo: String! | |
vehicleFloorAmount: Int! | |
principle: Int! | |
payoff: Int! | |
isPaid: Boolean @default(value: false) | |
paidDate: DateTime | |
titleStatus: String | |
meta: Json | |
floorDate: DateTime! | |
feeTotal: Int! | |
interestTotal: Int! | |
nextPaymentDate: DateTime | |
nextPaymentAmount: Int | |
floorPlanProvider: FloorPlanProvider! | |
floorPlanActions: [FloorPlanAction] | |
lineItems: [FloorPlanLineItem] | |
} | |
type DealershipIntegrationService { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
label: String! | |
service: String | |
serviceTypes: [DealershipIntegrationTypeEnum!]! @scalarList(strategy: RELATION) | |
dealerships: [DealershipIntegration!] | |
isActive: Boolean! @default(value: true) | |
status: String | |
statusMessage: String | |
authenticationType: DealershipIntegrationServiceAuthenticationTypeEnum! | |
} | |
type DealershipIntegration { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership! @relation(name: "DealershipIntegration") | |
username: String | |
password: String | |
loginError: Boolean @default(value: false) | |
loginErrorMessage: String | |
isActive: Boolean! @default(value: true) | |
service: DealershipIntegrationService! | |
} | |
type FloorPlanProvider { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String! | |
dealershipFloorPlans: [DealershipFloorPlan] | |
floorPlans: [FloorPlan] | |
} | |
type DealershipFloorPlan { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership! | |
floorPlanProvider: FloorPlanProvider! | |
username: String | |
password: String | |
loginError: Boolean @default(value: false) | |
} | |
type FloorPlanAction { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
floorplan: FloorPlan! | |
name: String! | |
value: String | |
isComplete: Boolean @default(value: false) | |
dueDate: DateTime | |
meta: Json | |
} | |
enum FloorPlanChargeTypeEnum { | |
CHARGE, CREDIT, PAYMENT | |
} | |
type FloorPlanLineItem { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String! | |
amount: Int! | |
floorPlan: FloorPlan! | |
lineItemLabel: String! #e.g. fee, interest | |
lineItemTypeType: FloorPlanChargeTypeEnum! | |
} | |
type DealerLicensePlate { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
dealership: Dealership! | |
store: Store | |
plateNumber: String! | |
isActive: Boolean! @default(value: true) | |
licensePlateLogs: [DealerLicensePlateLog!] @relation(name: "DealerLicensePlateLog") | |
} | |
type DealerLicensePlateUser { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String! | |
searchableName: String! | |
address: Address! | |
driverLicense: DriverLicense | |
checkouts: [DealerLicensePlateLog!] @relation(name: "DealerLicenseUser") | |
dealership: Dealership! | |
user: User | |
} | |
type DriverLicense { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
name: String! | |
address: Address | |
number: String | |
state: String | |
expires: DateTime | |
height: String | |
weight: String | |
DOB: DateTime | |
sex: String | |
issueDate: String | |
eyeColor: String | |
meta: Json | |
file: File | |
} | |
type DealerLicensePlateLog { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
store: Store | |
vehicle: Vehicle! @relation( name: "DealerLicensePlateLogVehicle") | |
dealership: Dealership! | |
dealerLicensePlate: DealerLicensePlate! @relation(name: "DealerLicensePlateLog") | |
dealerLicensePlateUser: DealerLicensePlateUser @relation(link: INLINE, name: "DealerLicensePlateUser") | |
checkout: DateTime! | |
returned: DateTime | |
checkoutMileage: Int | |
returnedMileage: Int | |
plateUser: DealerLicensePlateUser @relation(name: "DealerLicenseUser") | |
user: User @relation(link: INLINE, name: "DealerLicensePlateLogUser") | |
} | |
type Task { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
uniqueId: String! @unique | |
label: String | |
order: Int | |
status: DealTaskStatusEnum! | |
userViewCompleted: Boolean! @default(value: false) | |
isRequired: Boolean! @default(value: false) | |
isComplete: Boolean! @default(value: false) | |
completeBy: DateTime | |
scheduledFor: DateTime | |
completedAt: DateTime | |
isFor: [DealTaskIsForEnum]! @scalarList(strategy: RELATION) # shoudl change to "DEALER" "CUSTOMER" enum for Prisma 2 | |
isActive: Boolean! @default(value: false) | |
showCustomer: Boolean! @default(value: false) | |
taskData: Json | |
uiData: Json | |
customerUI: CustomerUIEnum! | |
dealerUI: DealerUIEnum! | |
eventFor: [EventEnum]! @scalarList(strategy: RELATION) | |
alertIndividualUsers: [User] @relation(name: "UserTask", onDelete: SET_NULL) | |
lineItems: [DealLineItem] @relation(name: "DealTaskLineItems") | |
deal: Deal @relation(name: "DealTask", onDelete: SET_NULL) | |
vehicle: Vehicle @relation(name: "VehicleTask", onDelete: SET_NULL) | |
dealership: Dealership @relation(name: "DealershipDealTask", onDelete: SET_NULL) | |
store: Store @relation(name: "DealStoreTask", onDelete: SET_NULL) | |
addOns: DealAddOn @relation(name: "DealAddOnTask") | |
} | |
type Note { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
from: User! | |
text: String! | |
tags: [String] @scalarList(strategy: RELATION) | |
vehicle: Vehicle | |
deal: Deal | |
dealership: Dealership! | |
} | |
type Notification { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
title: String! | |
description: String! | |
image: String | |
link: String | |
inAppNotifications: [InAppNotification!] | |
notificationId: String! | |
} | |
type InAppNotification { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
isRead: Boolean! @default(value: false) | |
user: User! | |
notification: Notification! | |
} | |
type UserNotificationPreference { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
event: EventEnum! | |
methods: [NotificationMethodEnum!] @scalarList(strategy: RELATION) | |
user: User! | |
} | |
type CustomerVehicleSearch { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
search: Json! | |
name: String! | |
user: User! | |
viewCount: Int @default(value: 0) | |
isDeleted: Boolean @default(value: false) | |
notifications: [CustomVehicleSearchNotificationOptionsEnum] @scalarList(strategy: RELATION) | |
} | |
#Bad name, should have been "EmailSubscription" Oh well | |
type EmailSubscriber { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
email: String! | |
subscriptionType: EmailSubscriptionTypeEnum! | |
tags: [String] @scalarList(strategy: RELATION) | |
isSubscribed: Boolean! @default(value: true) | |
isEmailVerified: Boolean @default(value: false) | |
signupDate: DateTime | |
lastOpenedDate: DateTime | |
lastClickedDate: DateTime | |
emailsReceived: Int | |
emailsOpened: Int | |
emailsClicked: Int | |
user: User | |
dealer: Dealership! @relation(name: "DealerEmailSubscriber", onDelete: SET_NULL) | |
} | |
type CustomerPlaidAccount { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
institution: String | |
accounts: Json | |
selectedAccountId: String | |
balance: Int | |
balanceDate: DateTime | |
link_session_id: String! | |
access_token: String | |
stripeToken: String | |
stripeResponse: Json | |
user: User! | |
} | |
type WebUpdate { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
image: String! | |
updateDate: DateTime! | |
imageCover: String | |
text: String! | |
updateType: String! | |
href: String! | |
dealer: Dealership! @relation(name: "DealerWebUpdate", onDelete: SET_NULL) | |
} | |
type VehicleHistoryReport { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
viewCount: Int @default(value: 0) | |
mobile: String | |
desktop: String | |
pdf: String | |
vin: String! | |
year: Int | |
make: String | |
model: String | |
drivetrain: String | |
fuel: String | |
color: String | |
transmission: String | |
vehicleType: String | |
price: Int | |
} | |
type PhysicalAccess { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
accessControl: AccessControlEnum! | |
startDate: DateTime! | |
endDate: DateTime! | |
expiresAfterStart: Int #countdown after start date | |
logs: [PhysicalAccessLog] | |
user: User | |
phoneNumbers: [PhoneNumber] | |
} | |
type PhysicalAccessLog { | |
id: ID! @id | |
createdAt: DateTime! @createdAt | |
updatedAt: DateTime! @updatedAt | |
access: PhysicalAccess! | |
action: String! | |
} | |
#type Calendar { | |
# id: ID! @id | |
# createdAt: DateTime! @createdAt | |
# updatedAt: DateTime! @updatedAt | |
# calendarDate: DateTime! | |
# showCustomer: Boolean! @default(value: true) | |
# calendarEvent: [EventEnum]! @scalarList(strategy: RELATION) | |
# alertIndividualUsers: [User] @relation(name: "UserCalendar", onDelete: SET_NULL) | |
# dealership: Dealership! @relation(name: "DealStoreTask", onDelete: SET_NULL) | |
# store: Store @relation(name: "DealStoreTask", onDelete: SET_NULL) | |
# deal: Deal @relation(name: "DealStoreTask", onDelete: SET_NULL) | |
# vehicle: Vehicle @relation(name: "VehicleCalendar", onDelete: SET_NULL) | |
#} | |
#Customer appointment | |
#// reasons for showing | |
#// time | |
#// isCancelled | |
# | |
#Vehicle Inspection appointment | |
#// time | |
#// isCancelled | |
#// for Deal | |
#// may need to schedule | |
#type Calender { | |
# id: ID! @id | |
# createdAt: DateTime! @createdAt | |
# updatedAt: DateTime! @updatedAt | |
# reasons: [String!]! | |
# appointmentAt: DateTime! | |
# isCancelled: Boolean @default(value: false) | |
# deal: Deal @relation(name: "DealAppointment", onDelete: SET_NULL) | |
# user: User! @relation(name: "UserAppointment", onDelete: SET_NULL) | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment