diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 7bb59f1..a46525f 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -24,9 +24,38 @@ model users { password String createdAt DateTime @default(now()) updatedAt DateTime + rides rides[] tokens tokens[] } +model companies { + id String @id + name String + cost_per_km Decimal @db.Decimal(10, 2) + notes String? @default("") + createdAt DateTime? @default(now()) @db.Timestamptz(6) + updatedAt DateTime? @default(now()) @db.Timestamptz(6) + + @@index([name], map: "idx_companies_name") +} + +model rides { + id String @id + user_id String + company String + km Decimal @db.Decimal(10, 2) + cost_per_km Decimal @db.Decimal(10, 2) + total Decimal @db.Decimal(10, 2) + ride_date String + synced Int? @default(0) @db.SmallInt + createdAt DateTime? @default(now()) @db.Timestamptz(6) + updatedAt DateTime? @default(now()) @db.Timestamptz(6) + users users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction) + + @@index([synced], map: "idx_rides_synced") + @@index([user_id], map: "idx_rides_user_id") +} + enum TokenType { REFRESH } diff --git a/backend/src/controllers/sync.controller.ts b/backend/src/controllers/sync.controller.ts new file mode 100644 index 0000000..bff26ca --- /dev/null +++ b/backend/src/controllers/sync.controller.ts @@ -0,0 +1,40 @@ +import { Request, Response } from 'express'; +import * as syncService from '../services/sync.service.js'; + +export async function syncCompanies(req: Request, res: Response): Promise { + try { + const parsed = syncService.syncCompaniesSchema.safeParse(req.body); + if (!parsed.success) { + res.status(400).json({ error: parsed.error.flatten() }); + return; + } + + const synced = await syncService.syncCompanies(parsed.data); + res.json({ + success: true, + message: `${synced.length} company/companies synced`, + data: synced, + }); + } catch (err: any) { + res.status(500).json({ error: err.message ?? 'Error syncing companies' }); + } +} + +export async function syncRides(req: Request, res: Response): Promise { + try { + const parsed = syncService.syncRidesSchema.safeParse(req.body); + if (!parsed.success) { + res.status(400).json({ error: parsed.error.flatten() }); + return; + } + + const synced = await syncService.syncRides(parsed.data); + res.json({ + success: true, + message: `${synced.length} ride(s) synced`, + data: synced, + }); + } catch (err: any) { + res.status(500).json({ error: err.message ?? 'Error syncing rides' }); + } +} diff --git a/backend/src/generated/prisma/browser.ts b/backend/src/generated/prisma/browser.ts index deb2ad6..4d3becb 100644 --- a/backend/src/generated/prisma/browser.ts +++ b/backend/src/generated/prisma/browser.ts @@ -27,3 +27,13 @@ export type tokens = Prisma.tokensModel * */ export type users = Prisma.usersModel +/** + * Model companies + * + */ +export type companies = Prisma.companiesModel +/** + * Model rides + * + */ +export type rides = Prisma.ridesModel diff --git a/backend/src/generated/prisma/client.ts b/backend/src/generated/prisma/client.ts index d8aad49..01a147f 100644 --- a/backend/src/generated/prisma/client.ts +++ b/backend/src/generated/prisma/client.ts @@ -51,3 +51,13 @@ export type tokens = Prisma.tokensModel * */ export type users = Prisma.usersModel +/** + * Model companies + * + */ +export type companies = Prisma.companiesModel +/** + * Model rides + * + */ +export type rides = Prisma.ridesModel diff --git a/backend/src/generated/prisma/commonInputTypes.ts b/backend/src/generated/prisma/commonInputTypes.ts index e6aba0b..08d9ad2 100644 --- a/backend/src/generated/prisma/commonInputTypes.ts +++ b/backend/src/generated/prisma/commonInputTypes.ts @@ -89,6 +89,123 @@ export type DateTimeWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDateTimeFilter<$PrismaModel> } +export type DecimalFilter<$PrismaModel = never> = { + equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type StringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type DateTimeNullableFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null +} + +export type SortOrderInput = { + sort: Prisma.SortOrder + nulls?: Prisma.NullsOrder +} + +export type DecimalWithAggregatesFilter<$PrismaModel = never> = { + equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + not?: Prisma.NestedDecimalWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _avg?: Prisma.NestedDecimalFilter<$PrismaModel> + _sum?: Prisma.NestedDecimalFilter<$PrismaModel> + _min?: Prisma.NestedDecimalFilter<$PrismaModel> + _max?: Prisma.NestedDecimalFilter<$PrismaModel> +} + +export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + +export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> +} + +export type IntNullableFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null +} + +export type IntNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _avg?: Prisma.NestedFloatNullableFilter<$PrismaModel> + _sum?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedIntNullableFilter<$PrismaModel> + _max?: Prisma.NestedIntNullableFilter<$PrismaModel> +} + export type NestedStringFilter<$PrismaModel = never> = { equals?: string | Prisma.StringFieldRefInput<$PrismaModel> in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> @@ -173,4 +290,125 @@ export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDateTimeFilter<$PrismaModel> } +export type NestedDecimalFilter<$PrismaModel = never> = { + equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type NestedStringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type NestedDateTimeNullableFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null +} + +export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = { + equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> + lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> + not?: Prisma.NestedDecimalWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _avg?: Prisma.NestedDecimalFilter<$PrismaModel> + _sum?: Prisma.NestedDecimalFilter<$PrismaModel> + _min?: Prisma.NestedDecimalFilter<$PrismaModel> + _max?: Prisma.NestedDecimalFilter<$PrismaModel> +} + +export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + +export type NestedIntNullableFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null +} + +export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> +} + +export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _avg?: Prisma.NestedFloatNullableFilter<$PrismaModel> + _sum?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedIntNullableFilter<$PrismaModel> + _max?: Prisma.NestedIntNullableFilter<$PrismaModel> +} + +export type NestedFloatNullableFilter<$PrismaModel = never> = { + equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.FloatFieldRefInput<$PrismaModel> + lte?: number | Prisma.FloatFieldRefInput<$PrismaModel> + gt?: number | Prisma.FloatFieldRefInput<$PrismaModel> + gte?: number | Prisma.FloatFieldRefInput<$PrismaModel> + not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null +} + diff --git a/backend/src/generated/prisma/internal/class.ts b/backend/src/generated/prisma/internal/class.ts index 396643e..5e82225 100644 --- a/backend/src/generated/prisma/internal/class.ts +++ b/backend/src/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.8.0", "engineVersion": "3c6e192761c0362d496ed980de936e2f3cebcd3a", "activeProvider": "postgresql", - "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel tokens {\n id String @id\n token String @unique\n type TokenType\n userId String\n expiresAt DateTime\n createdAt DateTime @default(now())\n users users @relation(fields: [userId], references: [id], onDelete: Cascade)\n}\n\nmodel users {\n id String @id\n name String\n email String @unique\n password String\n createdAt DateTime @default(now())\n updatedAt DateTime\n tokens tokens[]\n}\n\nenum TokenType {\n REFRESH\n}\n", + "inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel tokens {\n id String @id\n token String @unique\n type TokenType\n userId String\n expiresAt DateTime\n createdAt DateTime @default(now())\n users users @relation(fields: [userId], references: [id], onDelete: Cascade)\n}\n\nmodel users {\n id String @id\n name String\n email String @unique\n password String\n createdAt DateTime @default(now())\n updatedAt DateTime\n rides rides[]\n tokens tokens[]\n}\n\nmodel companies {\n id String @id\n name String\n cost_per_km Decimal @db.Decimal(10, 2)\n notes String? @default(\"\")\n createdAt DateTime? @default(now()) @db.Timestamptz(6)\n updatedAt DateTime? @default(now()) @db.Timestamptz(6)\n\n @@index([name], map: \"idx_companies_name\")\n}\n\nmodel rides {\n id String @id\n user_id String\n company String\n km Decimal @db.Decimal(10, 2)\n cost_per_km Decimal @db.Decimal(10, 2)\n total Decimal @db.Decimal(10, 2)\n ride_date String\n synced Int? @default(0) @db.SmallInt\n createdAt DateTime? @default(now()) @db.Timestamptz(6)\n updatedAt DateTime? @default(now()) @db.Timestamptz(6)\n users users @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)\n\n @@index([synced], map: \"idx_rides_synced\")\n @@index([user_id], map: \"idx_rides_user_id\")\n}\n\nenum TokenType {\n REFRESH\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -32,10 +32,10 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"tokens\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"token\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"TokenType\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"users\",\"relationName\":\"tokensTousers\"}],\"dbName\":null},\"users\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"tokens\",\"kind\":\"object\",\"type\":\"tokens\",\"relationName\":\"tokensTousers\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"tokens\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"token\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"TokenType\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"users\",\"relationName\":\"tokensTousers\"}],\"dbName\":null},\"users\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"rides\",\"kind\":\"object\",\"type\":\"rides\",\"relationName\":\"ridesTousers\"},{\"name\":\"tokens\",\"kind\":\"object\",\"type\":\"tokens\",\"relationName\":\"tokensTousers\"}],\"dbName\":null},\"companies\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"cost_per_km\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"rides\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"company\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"km\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"cost_per_km\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"ride_date\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"synced\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"users\",\"relationName\":\"ridesTousers\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") config.parameterizationSchema = { - strings: JSON.parse("[\"where\",\"orderBy\",\"cursor\",\"tokens\",\"_count\",\"users\",\"tokens.findUnique\",\"tokens.findUniqueOrThrow\",\"tokens.findFirst\",\"tokens.findFirstOrThrow\",\"tokens.findMany\",\"data\",\"tokens.createOne\",\"tokens.createMany\",\"tokens.createManyAndReturn\",\"tokens.updateOne\",\"tokens.updateMany\",\"tokens.updateManyAndReturn\",\"create\",\"update\",\"tokens.upsertOne\",\"tokens.deleteOne\",\"tokens.deleteMany\",\"having\",\"_min\",\"_max\",\"tokens.groupBy\",\"tokens.aggregate\",\"users.findUnique\",\"users.findUniqueOrThrow\",\"users.findFirst\",\"users.findFirstOrThrow\",\"users.findMany\",\"users.createOne\",\"users.createMany\",\"users.createManyAndReturn\",\"users.updateOne\",\"users.updateMany\",\"users.updateManyAndReturn\",\"users.upsertOne\",\"users.deleteOne\",\"users.deleteMany\",\"users.groupBy\",\"users.aggregate\",\"AND\",\"OR\",\"NOT\",\"id\",\"name\",\"email\",\"password\",\"createdAt\",\"updatedAt\",\"equals\",\"in\",\"notIn\",\"lt\",\"lte\",\"gt\",\"gte\",\"not\",\"contains\",\"startsWith\",\"endsWith\",\"every\",\"some\",\"none\",\"token\",\"TokenType\",\"type\",\"userId\",\"expiresAt\",\"is\",\"isNot\",\"connectOrCreate\",\"upsert\",\"createMany\",\"set\",\"disconnect\",\"delete\",\"connect\",\"updateMany\",\"deleteMany\"]"), - graph: "aBIgCgUAAEcAICwAAEUAMC0AAAMAEC4AAEUAMC8BAAAAATNAAD8AIUMBAAAAAUUAAEZFIkYBAD4AIUdAAD8AIQEAAAABACAKBQAARwAgLAAARQAwLQAAAwAQLgAARQAwLwEAPgAhM0AAPwAhQwEAPgAhRQAARkUiRgEAPgAhR0AAPwAhAQUAAGIAIAMAAAADACABAAAEADACAAABACABAAAAAwAgAQAAAAEAIAMAAAADACABAAAEADACAAABACADAAAAAwAgAQAABAAwAgAAAQAgAwAAAAMAIAEAAAQAMAIAAAEAIAcFAABhACAvAQAAAAEzQAAAAAFDAQAAAAFFAAAARQJGAQAAAAFHQAAAAAEBCwAACwAgBi8BAAAAATNAAAAAAUMBAAAAAUUAAABFAkYBAAAAAUdAAAAAAQELAAANADABCwAADQAwBwUAAGAAIC8BAEsAITNAAEwAIUMBAEsAIUUAAFhFIkYBAEsAIUdAAEwAIQIAAAABACALAAAQACAGLwEASwAhM0AATAAhQwEASwAhRQAAWEUiRgEASwAhR0AATAAhAgAAAAMAIAsAABIAIAIAAAADACALAAASACADAAAAAQAgEgAACwAgEwAAEAAgAQAAAAEAIAEAAAADACADBAAAXQAgGAAAXwAgGQAAXgAgCSwAAEEAMC0AABkAEC4AAEEAMC8BADYAITNAADcAIUMBADYAIUUAAEJFIkYBADYAIUdAADcAIQMAAAADACABAAAYADAXAAAZACADAAAAAwAgAQAABAAwAgAAAQAgCgMAAEAAICwAAD0AMC0AAB8AEC4AAD0AMC8BAAAAATABAD4AITEBAAAAATIBAD4AITNAAD8AITRAAD8AIQEAAAAcACABAAAAHAAgCgMAAEAAICwAAD0AMC0AAB8AEC4AAD0AMC8BAD4AITABAD4AITEBAD4AITIBAD4AITNAAD8AITRAAD8AIQEDAABcACADAAAAHwAgAQAAIAAwAgAAHAAgAwAAAB8AIAEAACAAMAIAABwAIAMAAAAfACABAAAgADACAAAcACAHAwAAWwAgLwEAAAABMAEAAAABMQEAAAABMgEAAAABM0AAAAABNEAAAAABAQsA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VADAtAABWABAuAABVADAvAQA-ACEzQAA_ACFDAQA-ACFFAABGRSJGAQA-ACFHQAA_ACEFLwEASwAhM0AATAAhQwEASwAhRQAAWEUiR0AATAAhAU0AAABFAgUvAQBLACEzQABMACFDAQBLACFFAABYRSJHQABMACEFLwEAAAABM0AAAAABQwEAAAABRQAAAEUCR0AAAAABBBIAAE4AMEoAAE8AMEwAAFEAIFAAAFIAMAAAAAAFEgAAYwAgEwAAZgAgSgAAZAAgSwAAZQAgUAAAHAAgAxIAAGMAIEoAAGQAIFAAABwAIAEDAABcACAGLwEAAAABMAEAAAABMQEAAAABMgEAAAABM0AAAAABNEAAAAABAgAAABwAIBIAAGMAIAMAAAAfACASAABjACATAABnACAIAAAAHwAgCwAAZwAgLwEASwAhMAEASwAhMQEASwAhMgEASwAhM0AATAAhNEAATAAhBi8BAEsAITABAEsAITEBAEsAITIBAEsAITNAAEwAITRAAEwAIQUvAQAAAAEzQAAAAAFDAQAAAAFFAAAARQJHQAAAAAEBBQACAgMFAQQAAwEDBgAAAQUAAgEFAAIDBAAIGAAJGQAKAAAAAwQACBgACRkACgAAAwQADxgAEBkAEQAAAAMEAA8YABAZABEGAgEHBwEICAEJCQEKCgEMDAENDgQODwUPEQEQEwQRFAYUFQEVFgEWFwQaGgcbGwscHQIdHgIeIQIfIgIgIwIhJQIiJwQjKAwkKgIlLAQmLQ0nLgIoLwIpMAQqMw4rNBI" + strings: JSON.parse("[\"where\",\"orderBy\",\"cursor\",\"users\",\"rides\",\"tokens\",\"_count\",\"tokens.findUnique\",\"tokens.findUniqueOrThrow\",\"tokens.findFirst\",\"tokens.findFirstOrThrow\",\"tokens.findMany\",\"data\",\"tokens.createOne\",\"tokens.createMany\",\"tokens.createManyAndReturn\",\"tokens.updateOne\",\"tokens.updateMany\",\"tokens.updateManyAndReturn\",\"create\",\"update\",\"tokens.upsertOne\",\"tokens.deleteOne\",\"tokens.deleteMany\",\"having\",\"_min\",\"_max\",\"tokens.groupBy\",\"tokens.aggregate\",\"users.findUnique\",\"users.findUniqueOrThrow\",\"users.findFirst\",\"users.findFirstOrThrow\",\"users.findMany\",\"users.createOne\",\"users.createMany\",\"users.createManyAndReturn\",\"users.updateOne\",\"users.updateMany\",\"users.updateManyAndReturn\",\"users.upsertOne\",\"users.deleteOne\",\"users.deleteMany\",\"users.groupBy\",\"users.aggregate\",\"companies.findUnique\",\"companies.findUniqueOrThrow\",\"companies.findFirst\",\"companies.findFirstOrThrow\",\"companies.findMany\",\"companies.createOne\",\"companies.createMany\",\"companies.createManyAndReturn\",\"companies.updateOne\",\"companies.updateMany\",\"companies.updateManyAndReturn\",\"companies.upsertOne\",\"companies.deleteOne\",\"companies.deleteMany\",\"_avg\",\"_sum\",\"companies.groupBy\",\"companies.aggregate\",\"rides.findUnique\",\"rides.findUniqueOrThrow\",\"rides.findFirst\",\"rides.findFirstOrThrow\",\"rides.findMany\",\"rides.createOne\",\"rides.createMany\",\"rides.createManyAndReturn\",\"rides.updateOne\",\"rides.updateMany\",\"rides.updateManyAndReturn\",\"rides.upsertOne\",\"rides.deleteOne\",\"rides.deleteMany\",\"rides.groupBy\",\"rides.aggregate\",\"AND\",\"OR\",\"NOT\",\"id\",\"user_id\",\"company\",\"km\",\"cost_per_km\",\"total\",\"ride_date\",\"synced\",\"createdAt\",\"updatedAt\",\"equals\",\"in\",\"notIn\",\"lt\",\"lte\",\"gt\",\"gte\",\"not\",\"contains\",\"startsWith\",\"endsWith\",\"name\",\"notes\",\"email\",\"password\",\"every\",\"some\",\"none\",\"token\",\"TokenType\",\"type\",\"userId\",\"expiresAt\",\"is\",\"isNot\",\"connectOrCreate\",\"upsert\",\"createMany\",\"set\",\"disconnect\",\"delete\",\"connect\",\"updateMany\",\"deleteMany\",\"increment\",\"decrement\",\"multiply\",\"divide\"]"), + graph: "2AEmQAoDAACPAQAgTwAAjQEAMFAAAAcAEFEAAI0BADBSAQAAAAFaQACGAQAhbgEAAAABcAAAjgFwInEBAH0AIXJAAIYBACEBAAAAAQA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Promise { @@ -207,6 +207,26 @@ export interface PrismaClient< * ``` */ get users(): Prisma.usersDelegate; + + /** + * `prisma.companies`: Exposes CRUD operations for the **companies** model. + * Example usage: + * ```ts + * // Fetch zero or more Companies + * const companies = await prisma.companies.findMany() + * ``` + */ + get companies(): Prisma.companiesDelegate; + + /** + * `prisma.rides`: Exposes CRUD operations for the **rides** model. + * Example usage: + * ```ts + * // Fetch zero or more Rides + * const rides = await prisma.rides.findMany() + * ``` + */ + get rides(): Prisma.ridesDelegate; } export function getPrismaClientClass(): PrismaClientConstructor { diff --git a/backend/src/generated/prisma/internal/prismaNamespace.ts b/backend/src/generated/prisma/internal/prismaNamespace.ts index e6e333a..8a74b69 100644 --- a/backend/src/generated/prisma/internal/prismaNamespace.ts +++ b/backend/src/generated/prisma/internal/prismaNamespace.ts @@ -385,7 +385,9 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { tokens: 'tokens', - users: 'users' + users: 'users', + companies: 'companies', + rides: 'rides' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -401,7 +403,7 @@ export type TypeMap + fields: Prisma.companiesFieldRefs + operations: { + findUnique: { + args: Prisma.companiesFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.companiesFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.companiesFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.companiesFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.companiesFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.companiesCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.companiesCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.companiesCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.companiesDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.companiesUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.companiesDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.companiesUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.companiesUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.companiesUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.CompaniesAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.companiesGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.companiesCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + rides: { + payload: Prisma.$ridesPayload + fields: Prisma.ridesFieldRefs + operations: { + findUnique: { + args: Prisma.ridesFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.ridesFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.ridesFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.ridesFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.ridesFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.ridesCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.ridesCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.ridesCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.ridesDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.ridesUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.ridesDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.ridesUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.ridesUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.ridesUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.RidesAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.ridesGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.ridesCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } } } & { other: { @@ -616,6 +766,34 @@ export const UsersScalarFieldEnum = { export type UsersScalarFieldEnum = (typeof UsersScalarFieldEnum)[keyof typeof UsersScalarFieldEnum] +export const CompaniesScalarFieldEnum = { + id: 'id', + name: 'name', + cost_per_km: 'cost_per_km', + notes: 'notes', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type CompaniesScalarFieldEnum = (typeof CompaniesScalarFieldEnum)[keyof typeof CompaniesScalarFieldEnum] + + +export const RidesScalarFieldEnum = { + id: 'id', + user_id: 'user_id', + company: 'company', + km: 'km', + cost_per_km: 'cost_per_km', + total: 'total', + ride_date: 'ride_date', + synced: 'synced', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type RidesScalarFieldEnum = (typeof RidesScalarFieldEnum)[keyof typeof RidesScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' @@ -632,6 +810,14 @@ export const QueryMode = { export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] +export const NullsOrder = { + first: 'first', + last: 'last' +} as const + +export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] + + /** * Field references @@ -680,6 +866,20 @@ export type ListDateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaM +/** + * Reference to a field of type 'Decimal' + */ +export type DecimalFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Decimal'> + + + +/** + * Reference to a field of type 'Decimal[]' + */ +export type ListDecimalFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Decimal[]'> + + + /** * Reference to a field of type 'Int' */ @@ -693,6 +893,20 @@ export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'In export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'> + +/** + * Reference to a field of type 'Float' + */ +export type FloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float'> + + + +/** + * Reference to a field of type 'Float[]' + */ +export type ListFloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float[]'> + + /** * Batch Payload for updateMany & deleteMany & createMany */ @@ -805,6 +1019,8 @@ export type PrismaClientOptions = ({ export type GlobalOmitConfig = { tokens?: Prisma.tokensOmit users?: Prisma.usersOmit + companies?: Prisma.companiesOmit + rides?: Prisma.ridesOmit } /* Types for Logging */ diff --git a/backend/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/backend/src/generated/prisma/internal/prismaNamespaceBrowser.ts index e3d1175..3fa5b20 100644 --- a/backend/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/backend/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -52,7 +52,9 @@ export const AnyNull = runtime.AnyNull export const ModelName = { tokens: 'tokens', - users: 'users' + users: 'users', + companies: 'companies', + rides: 'rides' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -95,6 +97,34 @@ export const UsersScalarFieldEnum = { export type UsersScalarFieldEnum = (typeof UsersScalarFieldEnum)[keyof typeof UsersScalarFieldEnum] +export const CompaniesScalarFieldEnum = { + id: 'id', + name: 'name', + cost_per_km: 'cost_per_km', + notes: 'notes', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type CompaniesScalarFieldEnum = (typeof CompaniesScalarFieldEnum)[keyof typeof CompaniesScalarFieldEnum] + + +export const RidesScalarFieldEnum = { + id: 'id', + user_id: 'user_id', + company: 'company', + km: 'km', + cost_per_km: 'cost_per_km', + total: 'total', + ride_date: 'ride_date', + synced: 'synced', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type RidesScalarFieldEnum = (typeof RidesScalarFieldEnum)[keyof typeof RidesScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' @@ -110,3 +140,11 @@ export const QueryMode = { export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] + +export const NullsOrder = { + first: 'first', + last: 'last' +} as const + +export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] + diff --git a/backend/src/generated/prisma/models.ts b/backend/src/generated/prisma/models.ts index c184538..89ff22e 100644 --- a/backend/src/generated/prisma/models.ts +++ b/backend/src/generated/prisma/models.ts @@ -10,4 +10,6 @@ */ export type * from './models/tokens.js' export type * from './models/users.js' +export type * from './models/companies.js' +export type * from './models/rides.js' export type * from './commonInputTypes.js' \ No newline at end of file diff --git a/backend/src/generated/prisma/models/companies.ts b/backend/src/generated/prisma/models/companies.ts new file mode 100644 index 0000000..eeeac33 --- /dev/null +++ b/backend/src/generated/prisma/models/companies.ts @@ -0,0 +1,1237 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `companies` model and its related types. + * + * 🟒 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model companies + * + */ +export type companiesModel = runtime.Types.Result.DefaultSelection + +export type AggregateCompanies = { + _count: CompaniesCountAggregateOutputType | null + _avg: CompaniesAvgAggregateOutputType | null + _sum: CompaniesSumAggregateOutputType | null + _min: CompaniesMinAggregateOutputType | null + _max: CompaniesMaxAggregateOutputType | null +} + +export type CompaniesAvgAggregateOutputType = { + cost_per_km: runtime.Decimal | null +} + +export type CompaniesSumAggregateOutputType = { + cost_per_km: runtime.Decimal | null +} + +export type CompaniesMinAggregateOutputType = { + id: string | null + name: string | null + cost_per_km: runtime.Decimal | null + notes: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type CompaniesMaxAggregateOutputType = { + id: string | null + name: string | null + cost_per_km: runtime.Decimal | null + notes: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type CompaniesCountAggregateOutputType = { + id: number + name: number + cost_per_km: number + notes: number + createdAt: number + updatedAt: number + _all: number +} + + +export type CompaniesAvgAggregateInputType = { + cost_per_km?: true +} + +export type CompaniesSumAggregateInputType = { + cost_per_km?: true +} + +export type CompaniesMinAggregateInputType = { + id?: true + name?: true + cost_per_km?: true + notes?: true + createdAt?: true + updatedAt?: true +} + +export type CompaniesMaxAggregateInputType = { + id?: true + name?: true + cost_per_km?: true + notes?: true + createdAt?: true + updatedAt?: true +} + +export type CompaniesCountAggregateInputType = { + id?: true + name?: true + cost_per_km?: true + notes?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type CompaniesAggregateArgs = { + /** + * Filter which companies to aggregate. + */ + where?: Prisma.companiesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of companies to fetch. + */ + orderBy?: Prisma.companiesOrderByWithRelationInput | Prisma.companiesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.companiesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` companies from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` companies. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned companies + **/ + _count?: true | CompaniesCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: CompaniesAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: CompaniesSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: CompaniesMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: CompaniesMaxAggregateInputType +} + +export type GetCompaniesAggregateType = { + [P in keyof T & keyof AggregateCompanies]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type companiesGroupByArgs = { + where?: Prisma.companiesWhereInput + orderBy?: Prisma.companiesOrderByWithAggregationInput | Prisma.companiesOrderByWithAggregationInput[] + by: Prisma.CompaniesScalarFieldEnum[] | Prisma.CompaniesScalarFieldEnum + having?: Prisma.companiesScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: CompaniesCountAggregateInputType | true + _avg?: CompaniesAvgAggregateInputType + _sum?: CompaniesSumAggregateInputType + _min?: CompaniesMinAggregateInputType + _max?: CompaniesMaxAggregateInputType +} + +export type CompaniesGroupByOutputType = { + id: string + name: string + cost_per_km: runtime.Decimal + notes: string | null + createdAt: Date | null + updatedAt: Date | null + _count: CompaniesCountAggregateOutputType | null + _avg: CompaniesAvgAggregateOutputType | null + _sum: CompaniesSumAggregateOutputType | null + _min: CompaniesMinAggregateOutputType | null + _max: CompaniesMaxAggregateOutputType | null +} + +export type GetCompaniesGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof CompaniesGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type companiesWhereInput = { + AND?: Prisma.companiesWhereInput | Prisma.companiesWhereInput[] + OR?: Prisma.companiesWhereInput[] + NOT?: Prisma.companiesWhereInput | Prisma.companiesWhereInput[] + id?: Prisma.StringFilter<"companies"> | string + name?: Prisma.StringFilter<"companies"> | string + cost_per_km?: Prisma.DecimalFilter<"companies"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableFilter<"companies"> | string | null + createdAt?: Prisma.DateTimeNullableFilter<"companies"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"companies"> | Date | string | null +} + +export type companiesOrderByWithRelationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder +} + +export type companiesWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: Prisma.companiesWhereInput | Prisma.companiesWhereInput[] + OR?: Prisma.companiesWhereInput[] + NOT?: Prisma.companiesWhereInput | Prisma.companiesWhereInput[] + name?: Prisma.StringFilter<"companies"> | string + cost_per_km?: Prisma.DecimalFilter<"companies"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableFilter<"companies"> | string | null + createdAt?: Prisma.DateTimeNullableFilter<"companies"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"companies"> | Date | string | null +}, "id"> + +export type companiesOrderByWithAggregationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + _count?: Prisma.companiesCountOrderByAggregateInput + _avg?: Prisma.companiesAvgOrderByAggregateInput + _max?: Prisma.companiesMaxOrderByAggregateInput + _min?: Prisma.companiesMinOrderByAggregateInput + _sum?: Prisma.companiesSumOrderByAggregateInput +} + +export type companiesScalarWhereWithAggregatesInput = { + AND?: Prisma.companiesScalarWhereWithAggregatesInput | Prisma.companiesScalarWhereWithAggregatesInput[] + OR?: Prisma.companiesScalarWhereWithAggregatesInput[] + NOT?: Prisma.companiesScalarWhereWithAggregatesInput | Prisma.companiesScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"companies"> | string + name?: Prisma.StringWithAggregatesFilter<"companies"> | string + cost_per_km?: Prisma.DecimalWithAggregatesFilter<"companies"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableWithAggregatesFilter<"companies"> | string | null + createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"companies"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"companies"> | Date | string | null +} + +export type companiesCreateInput = { + id: string + name: string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type companiesUncheckedCreateInput = { + id: string + name: string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type companiesUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type companiesUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type companiesCreateManyInput = { + id: string + name: string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type companiesUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type companiesUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type companiesCountOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + notes?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type companiesAvgOrderByAggregateInput = { + cost_per_km?: Prisma.SortOrder +} + +export type companiesMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + notes?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type companiesMinOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + notes?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type companiesSumOrderByAggregateInput = { + cost_per_km?: Prisma.SortOrder +} + +export type DecimalFieldUpdateOperationsInput = { + set?: runtime.Decimal | runtime.DecimalJsLike | number | string + increment?: runtime.Decimal | runtime.DecimalJsLike | number | string + decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string + multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string + divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type NullableStringFieldUpdateOperationsInput = { + set?: string | null +} + +export type NullableDateTimeFieldUpdateOperationsInput = { + set?: Date | string | null +} + + + +export type companiesSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + cost_per_km?: boolean + notes?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["companies"]> + +export type companiesSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + cost_per_km?: boolean + notes?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["companies"]> + +export type companiesSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + cost_per_km?: boolean + notes?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["companies"]> + +export type companiesSelectScalar = { + id?: boolean + name?: boolean + cost_per_km?: boolean + notes?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type companiesOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "cost_per_km" | "notes" | "createdAt" | "updatedAt", ExtArgs["result"]["companies"]> + +export type $companiesPayload = { + name: "companies" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + name: string + cost_per_km: runtime.Decimal + notes: string | null + createdAt: Date | null + updatedAt: Date | null + }, ExtArgs["result"]["companies"]> + composites: {} +} + +export type companiesGetPayload = runtime.Types.Result.GetResult + +export type companiesCountArgs = + Omit & { + select?: CompaniesCountAggregateInputType | true + } + +export interface companiesDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['companies'], meta: { name: 'companies' } } + /** + * Find zero or one Companies that matches the filter. + * @param {companiesFindUniqueArgs} args - Arguments to find a Companies + * @example + * // Get one Companies + * const companies = await prisma.companies.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Companies that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {companiesFindUniqueOrThrowArgs} args - Arguments to find a Companies + * @example + * // Get one Companies + * const companies = await prisma.companies.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Companies that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesFindFirstArgs} args - Arguments to find a Companies + * @example + * // Get one Companies + * const companies = await prisma.companies.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Companies that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesFindFirstOrThrowArgs} args - Arguments to find a Companies + * @example + * // Get one Companies + * const companies = await prisma.companies.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Companies that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Companies + * const companies = await prisma.companies.findMany() + * + * // Get first 10 Companies + * const companies = await prisma.companies.findMany({ take: 10 }) + * + * // Only select the `id` + * const companiesWithIdOnly = await prisma.companies.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Companies. + * @param {companiesCreateArgs} args - Arguments to create a Companies. + * @example + * // Create one Companies + * const Companies = await prisma.companies.create({ + * data: { + * // ... data to create a Companies + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Companies. + * @param {companiesCreateManyArgs} args - Arguments to create many Companies. + * @example + * // Create many Companies + * const companies = await prisma.companies.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Companies and returns the data saved in the database. + * @param {companiesCreateManyAndReturnArgs} args - Arguments to create many Companies. + * @example + * // Create many Companies + * const companies = await prisma.companies.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Companies and only return the `id` + * const companiesWithIdOnly = await prisma.companies.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a Companies. + * @param {companiesDeleteArgs} args - Arguments to delete one Companies. + * @example + * // Delete one Companies + * const Companies = await prisma.companies.delete({ + * where: { + * // ... filter to delete one Companies + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Companies. + * @param {companiesUpdateArgs} args - Arguments to update one Companies. + * @example + * // Update one Companies + * const companies = await prisma.companies.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Companies. + * @param {companiesDeleteManyArgs} args - Arguments to filter Companies to delete. + * @example + * // Delete a few Companies + * const { count } = await prisma.companies.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Companies. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Companies + * const companies = await prisma.companies.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Companies and returns the data updated in the database. + * @param {companiesUpdateManyAndReturnArgs} args - Arguments to update many Companies. + * @example + * // Update many Companies + * const companies = await prisma.companies.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Companies and only return the `id` + * const companiesWithIdOnly = await prisma.companies.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one Companies. + * @param {companiesUpsertArgs} args - Arguments to update or create a Companies. + * @example + * // Update or create a Companies + * const companies = await prisma.companies.upsert({ + * create: { + * // ... data to create a Companies + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Companies we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__companiesClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Companies. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesCountArgs} args - Arguments to filter Companies to count. + * @example + * // Count the number of Companies + * const count = await prisma.companies.count({ + * where: { + * // ... the filter for the Companies we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a Companies. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CompaniesAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by Companies. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {companiesGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends companiesGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: companiesGroupByArgs['orderBy'] } + : { orderBy?: companiesGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetCompaniesGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the companies model + */ +readonly fields: companiesFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for companies. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__companiesClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the companies model + */ +export interface companiesFieldRefs { + readonly id: Prisma.FieldRef<"companies", 'String'> + readonly name: Prisma.FieldRef<"companies", 'String'> + readonly cost_per_km: Prisma.FieldRef<"companies", 'Decimal'> + readonly notes: Prisma.FieldRef<"companies", 'String'> + readonly createdAt: Prisma.FieldRef<"companies", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"companies", 'DateTime'> +} + + +// Custom InputTypes +/** + * companies findUnique + */ +export type companiesFindUniqueArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter, which companies to fetch. + */ + where: Prisma.companiesWhereUniqueInput +} + +/** + * companies findUniqueOrThrow + */ +export type companiesFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter, which companies to fetch. + */ + where: Prisma.companiesWhereUniqueInput +} + +/** + * companies findFirst + */ +export type companiesFindFirstArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter, which companies to fetch. + */ + where?: Prisma.companiesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of companies to fetch. + */ + orderBy?: Prisma.companiesOrderByWithRelationInput | Prisma.companiesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for companies. + */ + cursor?: Prisma.companiesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` companies from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` companies. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of companies. + */ + distinct?: Prisma.CompaniesScalarFieldEnum | Prisma.CompaniesScalarFieldEnum[] +} + +/** + * companies findFirstOrThrow + */ +export type companiesFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter, which companies to fetch. + */ + where?: Prisma.companiesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of companies to fetch. + */ + orderBy?: Prisma.companiesOrderByWithRelationInput | Prisma.companiesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for companies. + */ + cursor?: Prisma.companiesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` companies from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` companies. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of companies. + */ + distinct?: Prisma.CompaniesScalarFieldEnum | Prisma.CompaniesScalarFieldEnum[] +} + +/** + * companies findMany + */ +export type companiesFindManyArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter, which companies to fetch. + */ + where?: Prisma.companiesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of companies to fetch. + */ + orderBy?: Prisma.companiesOrderByWithRelationInput | Prisma.companiesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing companies. + */ + cursor?: Prisma.companiesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` companies from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` companies. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of companies. + */ + distinct?: Prisma.CompaniesScalarFieldEnum | Prisma.CompaniesScalarFieldEnum[] +} + +/** + * companies create + */ +export type companiesCreateArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * The data needed to create a companies. + */ + data: Prisma.XOR +} + +/** + * companies createMany + */ +export type companiesCreateManyArgs = { + /** + * The data used to create many companies. + */ + data: Prisma.companiesCreateManyInput | Prisma.companiesCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * companies createManyAndReturn + */ +export type companiesCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelectCreateManyAndReturn | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * The data used to create many companies. + */ + data: Prisma.companiesCreateManyInput | Prisma.companiesCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * companies update + */ +export type companiesUpdateArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * The data needed to update a companies. + */ + data: Prisma.XOR + /** + * Choose, which companies to update. + */ + where: Prisma.companiesWhereUniqueInput +} + +/** + * companies updateMany + */ +export type companiesUpdateManyArgs = { + /** + * The data used to update companies. + */ + data: Prisma.XOR + /** + * Filter which companies to update + */ + where?: Prisma.companiesWhereInput + /** + * Limit how many companies to update. + */ + limit?: number +} + +/** + * companies updateManyAndReturn + */ +export type companiesUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * The data used to update companies. + */ + data: Prisma.XOR + /** + * Filter which companies to update + */ + where?: Prisma.companiesWhereInput + /** + * Limit how many companies to update. + */ + limit?: number +} + +/** + * companies upsert + */ +export type companiesUpsertArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * The filter to search for the companies to update in case it exists. + */ + where: Prisma.companiesWhereUniqueInput + /** + * In case the companies found by the `where` argument doesn't exist, create a new companies with this data. + */ + create: Prisma.XOR + /** + * In case the companies was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * companies delete + */ +export type companiesDeleteArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null + /** + * Filter which companies to delete. + */ + where: Prisma.companiesWhereUniqueInput +} + +/** + * companies deleteMany + */ +export type companiesDeleteManyArgs = { + /** + * Filter which companies to delete + */ + where?: Prisma.companiesWhereInput + /** + * Limit how many companies to delete. + */ + limit?: number +} + +/** + * companies without action + */ +export type companiesDefaultArgs = { + /** + * Select specific fields to fetch from the companies + */ + select?: Prisma.companiesSelect | null + /** + * Omit specific fields from the companies + */ + omit?: Prisma.companiesOmit | null +} diff --git a/backend/src/generated/prisma/models/rides.ts b/backend/src/generated/prisma/models/rides.ts new file mode 100644 index 0000000..18b28f7 --- /dev/null +++ b/backend/src/generated/prisma/models/rides.ts @@ -0,0 +1,1590 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `rides` model and its related types. + * + * 🟒 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model rides + * + */ +export type ridesModel = runtime.Types.Result.DefaultSelection + +export type AggregateRides = { + _count: RidesCountAggregateOutputType | null + _avg: RidesAvgAggregateOutputType | null + _sum: RidesSumAggregateOutputType | null + _min: RidesMinAggregateOutputType | null + _max: RidesMaxAggregateOutputType | null +} + +export type RidesAvgAggregateOutputType = { + km: runtime.Decimal | null + cost_per_km: runtime.Decimal | null + total: runtime.Decimal | null + synced: number | null +} + +export type RidesSumAggregateOutputType = { + km: runtime.Decimal | null + cost_per_km: runtime.Decimal | null + total: runtime.Decimal | null + synced: number | null +} + +export type RidesMinAggregateOutputType = { + id: string | null + user_id: string | null + company: string | null + km: runtime.Decimal | null + cost_per_km: runtime.Decimal | null + total: runtime.Decimal | null + ride_date: string | null + synced: number | null + createdAt: Date | null + updatedAt: Date | null +} + +export type RidesMaxAggregateOutputType = { + id: string | null + user_id: string | null + company: string | null + km: runtime.Decimal | null + cost_per_km: runtime.Decimal | null + total: runtime.Decimal | null + ride_date: string | null + synced: number | null + createdAt: Date | null + updatedAt: Date | null +} + +export type RidesCountAggregateOutputType = { + id: number + user_id: number + company: number + km: number + cost_per_km: number + total: number + ride_date: number + synced: number + createdAt: number + updatedAt: number + _all: number +} + + +export type RidesAvgAggregateInputType = { + km?: true + cost_per_km?: true + total?: true + synced?: true +} + +export type RidesSumAggregateInputType = { + km?: true + cost_per_km?: true + total?: true + synced?: true +} + +export type RidesMinAggregateInputType = { + id?: true + user_id?: true + company?: true + km?: true + cost_per_km?: true + total?: true + ride_date?: true + synced?: true + createdAt?: true + updatedAt?: true +} + +export type RidesMaxAggregateInputType = { + id?: true + user_id?: true + company?: true + km?: true + cost_per_km?: true + total?: true + ride_date?: true + synced?: true + createdAt?: true + updatedAt?: true +} + +export type RidesCountAggregateInputType = { + id?: true + user_id?: true + company?: true + km?: true + cost_per_km?: true + total?: true + ride_date?: true + synced?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type RidesAggregateArgs = { + /** + * Filter which rides to aggregate. + */ + where?: Prisma.ridesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of rides to fetch. + */ + orderBy?: Prisma.ridesOrderByWithRelationInput | Prisma.ridesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.ridesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` rides from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` rides. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned rides + **/ + _count?: true | RidesCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: RidesAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: RidesSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: RidesMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: RidesMaxAggregateInputType +} + +export type GetRidesAggregateType = { + [P in keyof T & keyof AggregateRides]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type ridesGroupByArgs = { + where?: Prisma.ridesWhereInput + orderBy?: Prisma.ridesOrderByWithAggregationInput | Prisma.ridesOrderByWithAggregationInput[] + by: Prisma.RidesScalarFieldEnum[] | Prisma.RidesScalarFieldEnum + having?: Prisma.ridesScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: RidesCountAggregateInputType | true + _avg?: RidesAvgAggregateInputType + _sum?: RidesSumAggregateInputType + _min?: RidesMinAggregateInputType + _max?: RidesMaxAggregateInputType +} + +export type RidesGroupByOutputType = { + id: string + user_id: string + company: string + km: runtime.Decimal + cost_per_km: runtime.Decimal + total: runtime.Decimal + ride_date: string + synced: number | null + createdAt: Date | null + updatedAt: Date | null + _count: RidesCountAggregateOutputType | null + _avg: RidesAvgAggregateOutputType | null + _sum: RidesSumAggregateOutputType | null + _min: RidesMinAggregateOutputType | null + _max: RidesMaxAggregateOutputType | null +} + +export type GetRidesGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof RidesGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type ridesWhereInput = { + AND?: Prisma.ridesWhereInput | Prisma.ridesWhereInput[] + OR?: Prisma.ridesWhereInput[] + NOT?: Prisma.ridesWhereInput | Prisma.ridesWhereInput[] + id?: Prisma.StringFilter<"rides"> | string + user_id?: Prisma.StringFilter<"rides"> | string + company?: Prisma.StringFilter<"rides"> | string + km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFilter<"rides"> | string + synced?: Prisma.IntNullableFilter<"rides"> | number | null + createdAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null + users?: Prisma.XOR +} + +export type ridesOrderByWithRelationInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + company?: Prisma.SortOrder + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + ride_date?: Prisma.SortOrder + synced?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + users?: Prisma.usersOrderByWithRelationInput +} + +export type ridesWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: Prisma.ridesWhereInput | Prisma.ridesWhereInput[] + OR?: Prisma.ridesWhereInput[] + NOT?: Prisma.ridesWhereInput | Prisma.ridesWhereInput[] + user_id?: Prisma.StringFilter<"rides"> | string + company?: Prisma.StringFilter<"rides"> | string + km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFilter<"rides"> | string + synced?: Prisma.IntNullableFilter<"rides"> | number | null + createdAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null + users?: Prisma.XOR +}, "id"> + +export type ridesOrderByWithAggregationInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + company?: Prisma.SortOrder + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + ride_date?: Prisma.SortOrder + synced?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + _count?: Prisma.ridesCountOrderByAggregateInput + _avg?: Prisma.ridesAvgOrderByAggregateInput + _max?: Prisma.ridesMaxOrderByAggregateInput + _min?: Prisma.ridesMinOrderByAggregateInput + _sum?: Prisma.ridesSumOrderByAggregateInput +} + +export type ridesScalarWhereWithAggregatesInput = { + AND?: Prisma.ridesScalarWhereWithAggregatesInput | Prisma.ridesScalarWhereWithAggregatesInput[] + OR?: Prisma.ridesScalarWhereWithAggregatesInput[] + NOT?: Prisma.ridesScalarWhereWithAggregatesInput | Prisma.ridesScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"rides"> | string + user_id?: Prisma.StringWithAggregatesFilter<"rides"> | string + company?: Prisma.StringWithAggregatesFilter<"rides"> | string + km?: Prisma.DecimalWithAggregatesFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalWithAggregatesFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalWithAggregatesFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringWithAggregatesFilter<"rides"> | string + synced?: Prisma.IntNullableWithAggregatesFilter<"rides"> | number | null + createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"rides"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"rides"> | Date | string | null +} + +export type ridesCreateInput = { + id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null + users: Prisma.usersCreateNestedOneWithoutRidesInput +} + +export type ridesUncheckedCreateInput = { + id: string + user_id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type ridesUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + users?: Prisma.usersUpdateOneRequiredWithoutRidesNestedInput +} + +export type ridesUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + user_id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ridesCreateManyInput = { + id: string + user_id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type ridesUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ridesUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + user_id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type RidesListRelationFilter = { + every?: Prisma.ridesWhereInput + some?: Prisma.ridesWhereInput + none?: Prisma.ridesWhereInput +} + +export type ridesOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type ridesCountOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + company?: Prisma.SortOrder + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + ride_date?: Prisma.SortOrder + synced?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type ridesAvgOrderByAggregateInput = { + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + synced?: Prisma.SortOrder +} + +export type ridesMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + company?: Prisma.SortOrder + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + ride_date?: Prisma.SortOrder + synced?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type ridesMinOrderByAggregateInput = { + id?: Prisma.SortOrder + user_id?: Prisma.SortOrder + company?: Prisma.SortOrder + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + ride_date?: Prisma.SortOrder + synced?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type ridesSumOrderByAggregateInput = { + km?: Prisma.SortOrder + cost_per_km?: Prisma.SortOrder + total?: Prisma.SortOrder + synced?: Prisma.SortOrder +} + +export type ridesCreateNestedManyWithoutUsersInput = { + create?: Prisma.XOR | Prisma.ridesCreateWithoutUsersInput[] | Prisma.ridesUncheckedCreateWithoutUsersInput[] + connectOrCreate?: Prisma.ridesCreateOrConnectWithoutUsersInput | Prisma.ridesCreateOrConnectWithoutUsersInput[] + createMany?: Prisma.ridesCreateManyUsersInputEnvelope + connect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] +} + +export type ridesUncheckedCreateNestedManyWithoutUsersInput = { + create?: Prisma.XOR | Prisma.ridesCreateWithoutUsersInput[] | Prisma.ridesUncheckedCreateWithoutUsersInput[] + connectOrCreate?: Prisma.ridesCreateOrConnectWithoutUsersInput | Prisma.ridesCreateOrConnectWithoutUsersInput[] + createMany?: Prisma.ridesCreateManyUsersInputEnvelope + connect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] +} + +export type ridesUpdateManyWithoutUsersNestedInput = { + create?: Prisma.XOR | Prisma.ridesCreateWithoutUsersInput[] | Prisma.ridesUncheckedCreateWithoutUsersInput[] + connectOrCreate?: Prisma.ridesCreateOrConnectWithoutUsersInput | Prisma.ridesCreateOrConnectWithoutUsersInput[] + upsert?: Prisma.ridesUpsertWithWhereUniqueWithoutUsersInput | Prisma.ridesUpsertWithWhereUniqueWithoutUsersInput[] + createMany?: Prisma.ridesCreateManyUsersInputEnvelope + set?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + disconnect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + delete?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + connect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + update?: Prisma.ridesUpdateWithWhereUniqueWithoutUsersInput | Prisma.ridesUpdateWithWhereUniqueWithoutUsersInput[] + updateMany?: Prisma.ridesUpdateManyWithWhereWithoutUsersInput | Prisma.ridesUpdateManyWithWhereWithoutUsersInput[] + deleteMany?: Prisma.ridesScalarWhereInput | Prisma.ridesScalarWhereInput[] +} + +export type ridesUncheckedUpdateManyWithoutUsersNestedInput = { + create?: Prisma.XOR | Prisma.ridesCreateWithoutUsersInput[] | Prisma.ridesUncheckedCreateWithoutUsersInput[] + connectOrCreate?: Prisma.ridesCreateOrConnectWithoutUsersInput | Prisma.ridesCreateOrConnectWithoutUsersInput[] + upsert?: Prisma.ridesUpsertWithWhereUniqueWithoutUsersInput | Prisma.ridesUpsertWithWhereUniqueWithoutUsersInput[] + createMany?: Prisma.ridesCreateManyUsersInputEnvelope + set?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + disconnect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + delete?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + connect?: Prisma.ridesWhereUniqueInput | Prisma.ridesWhereUniqueInput[] + update?: Prisma.ridesUpdateWithWhereUniqueWithoutUsersInput | Prisma.ridesUpdateWithWhereUniqueWithoutUsersInput[] + updateMany?: Prisma.ridesUpdateManyWithWhereWithoutUsersInput | Prisma.ridesUpdateManyWithWhereWithoutUsersInput[] + deleteMany?: Prisma.ridesScalarWhereInput | Prisma.ridesScalarWhereInput[] +} + +export type NullableIntFieldUpdateOperationsInput = { + set?: number | null + increment?: number + decrement?: number + multiply?: number + divide?: number +} + +export type ridesCreateWithoutUsersInput = { + id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type ridesUncheckedCreateWithoutUsersInput = { + id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type ridesCreateOrConnectWithoutUsersInput = { + where: Prisma.ridesWhereUniqueInput + create: Prisma.XOR +} + +export type ridesCreateManyUsersInputEnvelope = { + data: Prisma.ridesCreateManyUsersInput | Prisma.ridesCreateManyUsersInput[] + skipDuplicates?: boolean +} + +export type ridesUpsertWithWhereUniqueWithoutUsersInput = { + where: Prisma.ridesWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type ridesUpdateWithWhereUniqueWithoutUsersInput = { + where: Prisma.ridesWhereUniqueInput + data: Prisma.XOR +} + +export type ridesUpdateManyWithWhereWithoutUsersInput = { + where: Prisma.ridesScalarWhereInput + data: Prisma.XOR +} + +export type ridesScalarWhereInput = { + AND?: Prisma.ridesScalarWhereInput | Prisma.ridesScalarWhereInput[] + OR?: Prisma.ridesScalarWhereInput[] + NOT?: Prisma.ridesScalarWhereInput | Prisma.ridesScalarWhereInput[] + id?: Prisma.StringFilter<"rides"> | string + user_id?: Prisma.StringFilter<"rides"> | string + company?: Prisma.StringFilter<"rides"> | string + km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFilter<"rides"> | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFilter<"rides"> | string + synced?: Prisma.IntNullableFilter<"rides"> | number | null + createdAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"rides"> | Date | string | null +} + +export type ridesCreateManyUsersInput = { + id: string + company: string + km: runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km: runtime.Decimal | runtime.DecimalJsLike | number | string + total: runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date: string + synced?: number | null + createdAt?: Date | string | null + updatedAt?: Date | string | null +} + +export type ridesUpdateWithoutUsersInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ridesUncheckedUpdateWithoutUsersInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ridesUncheckedUpdateManyWithoutUsersInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + company?: Prisma.StringFieldUpdateOperationsInput | string + km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + cost_per_km?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + total?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + ride_date?: Prisma.StringFieldUpdateOperationsInput | string + synced?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + + + +export type ridesSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + company?: boolean + km?: boolean + cost_per_km?: boolean + total?: boolean + ride_date?: boolean + synced?: boolean + createdAt?: boolean + updatedAt?: boolean + users?: boolean | Prisma.usersDefaultArgs +}, ExtArgs["result"]["rides"]> + +export type ridesSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + company?: boolean + km?: boolean + cost_per_km?: boolean + total?: boolean + ride_date?: boolean + synced?: boolean + createdAt?: boolean + updatedAt?: boolean + users?: boolean | Prisma.usersDefaultArgs +}, ExtArgs["result"]["rides"]> + +export type ridesSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + user_id?: boolean + company?: boolean + km?: boolean + cost_per_km?: boolean + total?: boolean + ride_date?: boolean + synced?: boolean + createdAt?: boolean + updatedAt?: boolean + users?: boolean | Prisma.usersDefaultArgs +}, ExtArgs["result"]["rides"]> + +export type ridesSelectScalar = { + id?: boolean + user_id?: boolean + company?: boolean + km?: boolean + cost_per_km?: boolean + total?: boolean + ride_date?: boolean + synced?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type ridesOmit = runtime.Types.Extensions.GetOmit<"id" | "user_id" | "company" | "km" | "cost_per_km" | "total" | "ride_date" | "synced" | "createdAt" | "updatedAt", ExtArgs["result"]["rides"]> +export type ridesInclude = { + users?: boolean | Prisma.usersDefaultArgs +} +export type ridesIncludeCreateManyAndReturn = { + users?: boolean | Prisma.usersDefaultArgs +} +export type ridesIncludeUpdateManyAndReturn = { + users?: boolean | Prisma.usersDefaultArgs +} + +export type $ridesPayload = { + name: "rides" + objects: { + users: Prisma.$usersPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + user_id: string + company: string + km: runtime.Decimal + cost_per_km: runtime.Decimal + total: runtime.Decimal + ride_date: string + synced: number | null + createdAt: Date | null + updatedAt: Date | null + }, ExtArgs["result"]["rides"]> + composites: {} +} + +export type ridesGetPayload = runtime.Types.Result.GetResult + +export type ridesCountArgs = + Omit & { + select?: RidesCountAggregateInputType | true + } + +export interface ridesDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['rides'], meta: { name: 'rides' } } + /** + * Find zero or one Rides that matches the filter. + * @param {ridesFindUniqueArgs} args - Arguments to find a Rides + * @example + * // Get one Rides + * const rides = await prisma.rides.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Rides that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {ridesFindUniqueOrThrowArgs} args - Arguments to find a Rides + * @example + * // Get one Rides + * const rides = await prisma.rides.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Rides that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesFindFirstArgs} args - Arguments to find a Rides + * @example + * // Get one Rides + * const rides = await prisma.rides.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Rides that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesFindFirstOrThrowArgs} args - Arguments to find a Rides + * @example + * // Get one Rides + * const rides = await prisma.rides.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Rides that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Rides + * const rides = await prisma.rides.findMany() + * + * // Get first 10 Rides + * const rides = await prisma.rides.findMany({ take: 10 }) + * + * // Only select the `id` + * const ridesWithIdOnly = await prisma.rides.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Rides. + * @param {ridesCreateArgs} args - Arguments to create a Rides. + * @example + * // Create one Rides + * const Rides = await prisma.rides.create({ + * data: { + * // ... data to create a Rides + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Rides. + * @param {ridesCreateManyArgs} args - Arguments to create many Rides. + * @example + * // Create many Rides + * const rides = await prisma.rides.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Rides and returns the data saved in the database. + * @param {ridesCreateManyAndReturnArgs} args - Arguments to create many Rides. + * @example + * // Create many Rides + * const rides = await prisma.rides.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Rides and only return the `id` + * const ridesWithIdOnly = await prisma.rides.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a Rides. + * @param {ridesDeleteArgs} args - Arguments to delete one Rides. + * @example + * // Delete one Rides + * const Rides = await prisma.rides.delete({ + * where: { + * // ... filter to delete one Rides + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Rides. + * @param {ridesUpdateArgs} args - Arguments to update one Rides. + * @example + * // Update one Rides + * const rides = await prisma.rides.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Rides. + * @param {ridesDeleteManyArgs} args - Arguments to filter Rides to delete. + * @example + * // Delete a few Rides + * const { count } = await prisma.rides.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Rides. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Rides + * const rides = await prisma.rides.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Rides and returns the data updated in the database. + * @param {ridesUpdateManyAndReturnArgs} args - Arguments to update many Rides. + * @example + * // Update many Rides + * const rides = await prisma.rides.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Rides and only return the `id` + * const ridesWithIdOnly = await prisma.rides.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one Rides. + * @param {ridesUpsertArgs} args - Arguments to update or create a Rides. + * @example + * // Update or create a Rides + * const rides = await prisma.rides.upsert({ + * create: { + * // ... data to create a Rides + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Rides we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ridesClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Rides. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesCountArgs} args - Arguments to filter Rides to count. + * @example + * // Count the number of Rides + * const count = await prisma.rides.count({ + * where: { + * // ... the filter for the Rides we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a Rides. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {RidesAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by Rides. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ridesGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends ridesGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: ridesGroupByArgs['orderBy'] } + : { orderBy?: ridesGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetRidesGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the rides model + */ +readonly fields: ridesFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for rides. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__ridesClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + users = {}>(args?: Prisma.Subset>): Prisma.Prisma__usersClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the rides model + */ +export interface ridesFieldRefs { + readonly id: Prisma.FieldRef<"rides", 'String'> + readonly user_id: Prisma.FieldRef<"rides", 'String'> + readonly company: Prisma.FieldRef<"rides", 'String'> + readonly km: Prisma.FieldRef<"rides", 'Decimal'> + readonly cost_per_km: Prisma.FieldRef<"rides", 'Decimal'> + readonly total: Prisma.FieldRef<"rides", 'Decimal'> + readonly ride_date: Prisma.FieldRef<"rides", 'String'> + readonly synced: Prisma.FieldRef<"rides", 'Int'> + readonly createdAt: Prisma.FieldRef<"rides", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"rides", 'DateTime'> +} + + +// Custom InputTypes +/** + * rides findUnique + */ +export type ridesFindUniqueArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter, which rides to fetch. + */ + where: Prisma.ridesWhereUniqueInput +} + +/** + * rides findUniqueOrThrow + */ +export type ridesFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter, which rides to fetch. + */ + where: Prisma.ridesWhereUniqueInput +} + +/** + * rides findFirst + */ +export type ridesFindFirstArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter, which rides to fetch. + */ + where?: Prisma.ridesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of rides to fetch. + */ + orderBy?: Prisma.ridesOrderByWithRelationInput | Prisma.ridesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for rides. + */ + cursor?: Prisma.ridesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` rides from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` rides. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of rides. + */ + distinct?: Prisma.RidesScalarFieldEnum | Prisma.RidesScalarFieldEnum[] +} + +/** + * rides findFirstOrThrow + */ +export type ridesFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter, which rides to fetch. + */ + where?: Prisma.ridesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of rides to fetch. + */ + orderBy?: Prisma.ridesOrderByWithRelationInput | Prisma.ridesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for rides. + */ + cursor?: Prisma.ridesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` rides from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` rides. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of rides. + */ + distinct?: Prisma.RidesScalarFieldEnum | Prisma.RidesScalarFieldEnum[] +} + +/** + * rides findMany + */ +export type ridesFindManyArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter, which rides to fetch. + */ + where?: Prisma.ridesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of rides to fetch. + */ + orderBy?: Prisma.ridesOrderByWithRelationInput | Prisma.ridesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing rides. + */ + cursor?: Prisma.ridesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `Β±n` rides from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` rides. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of rides. + */ + distinct?: Prisma.RidesScalarFieldEnum | Prisma.RidesScalarFieldEnum[] +} + +/** + * rides create + */ +export type ridesCreateArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * The data needed to create a rides. + */ + data: Prisma.XOR +} + +/** + * rides createMany + */ +export type ridesCreateManyArgs = { + /** + * The data used to create many rides. + */ + data: Prisma.ridesCreateManyInput | Prisma.ridesCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * rides createManyAndReturn + */ +export type ridesCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelectCreateManyAndReturn | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * The data used to create many rides. + */ + data: Prisma.ridesCreateManyInput | Prisma.ridesCreateManyInput[] + skipDuplicates?: boolean + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesIncludeCreateManyAndReturn | null +} + +/** + * rides update + */ +export type ridesUpdateArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * The data needed to update a rides. + */ + data: Prisma.XOR + /** + * Choose, which rides to update. + */ + where: Prisma.ridesWhereUniqueInput +} + +/** + * rides updateMany + */ +export type ridesUpdateManyArgs = { + /** + * The data used to update rides. + */ + data: Prisma.XOR + /** + * Filter which rides to update + */ + where?: Prisma.ridesWhereInput + /** + * Limit how many rides to update. + */ + limit?: number +} + +/** + * rides updateManyAndReturn + */ +export type ridesUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * The data used to update rides. + */ + data: Prisma.XOR + /** + * Filter which rides to update + */ + where?: Prisma.ridesWhereInput + /** + * Limit how many rides to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesIncludeUpdateManyAndReturn | null +} + +/** + * rides upsert + */ +export type ridesUpsertArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * The filter to search for the rides to update in case it exists. + */ + where: Prisma.ridesWhereUniqueInput + /** + * In case the rides found by the `where` argument doesn't exist, create a new rides with this data. + */ + create: Prisma.XOR + /** + * In case the rides was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * rides delete + */ +export type ridesDeleteArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + /** + * Filter which rides to delete. + */ + where: Prisma.ridesWhereUniqueInput +} + +/** + * rides deleteMany + */ +export type ridesDeleteManyArgs = { + /** + * Filter which rides to delete + */ + where?: Prisma.ridesWhereInput + /** + * Limit how many rides to delete. + */ + limit?: number +} + +/** + * rides without action + */ +export type ridesDefaultArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null +} diff --git a/backend/src/generated/prisma/models/users.ts b/backend/src/generated/prisma/models/users.ts index 8dd0d00..5397521 100644 --- a/backend/src/generated/prisma/models/users.ts +++ b/backend/src/generated/prisma/models/users.ts @@ -190,6 +190,7 @@ export type usersWhereInput = { password?: Prisma.StringFilter<"users"> | string createdAt?: Prisma.DateTimeFilter<"users"> | Date | string updatedAt?: Prisma.DateTimeFilter<"users"> | Date | string + rides?: Prisma.RidesListRelationFilter tokens?: Prisma.TokensListRelationFilter } @@ -200,6 +201,7 @@ export type usersOrderByWithRelationInput = { password?: Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder + rides?: Prisma.ridesOrderByRelationAggregateInput tokens?: Prisma.tokensOrderByRelationAggregateInput } @@ -213,6 +215,7 @@ export type usersWhereUniqueInput = Prisma.AtLeast<{ password?: Prisma.StringFilter<"users"> | string createdAt?: Prisma.DateTimeFilter<"users"> | Date | string updatedAt?: Prisma.DateTimeFilter<"users"> | Date | string + rides?: Prisma.RidesListRelationFilter tokens?: Prisma.TokensListRelationFilter }, "id" | "email"> @@ -247,6 +250,7 @@ export type usersCreateInput = { password: string createdAt?: Date | string updatedAt: Date | string + rides?: Prisma.ridesCreateNestedManyWithoutUsersInput tokens?: Prisma.tokensCreateNestedManyWithoutUsersInput } @@ -257,6 +261,7 @@ export type usersUncheckedCreateInput = { password: string createdAt?: Date | string updatedAt: Date | string + rides?: Prisma.ridesUncheckedCreateNestedManyWithoutUsersInput tokens?: Prisma.tokensUncheckedCreateNestedManyWithoutUsersInput } @@ -267,6 +272,7 @@ export type usersUpdateInput = { password?: Prisma.StringFieldUpdateOperationsInput | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rides?: Prisma.ridesUpdateManyWithoutUsersNestedInput tokens?: Prisma.tokensUpdateManyWithoutUsersNestedInput } @@ -277,6 +283,7 @@ export type usersUncheckedUpdateInput = { password?: Prisma.StringFieldUpdateOperationsInput | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rides?: Prisma.ridesUncheckedUpdateManyWithoutUsersNestedInput tokens?: Prisma.tokensUncheckedUpdateManyWithoutUsersNestedInput } @@ -353,6 +360,20 @@ export type usersUpdateOneRequiredWithoutTokensNestedInput = { update?: Prisma.XOR, Prisma.usersUncheckedUpdateWithoutTokensInput> } +export type usersCreateNestedOneWithoutRidesInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.usersCreateOrConnectWithoutRidesInput + connect?: Prisma.usersWhereUniqueInput +} + +export type usersUpdateOneRequiredWithoutRidesNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.usersCreateOrConnectWithoutRidesInput + upsert?: Prisma.usersUpsertWithoutRidesInput + connect?: Prisma.usersWhereUniqueInput + update?: Prisma.XOR, Prisma.usersUncheckedUpdateWithoutRidesInput> +} + export type usersCreateWithoutTokensInput = { id: string name: string @@ -360,6 +381,7 @@ export type usersCreateWithoutTokensInput = { password: string createdAt?: Date | string updatedAt: Date | string + rides?: Prisma.ridesCreateNestedManyWithoutUsersInput } export type usersUncheckedCreateWithoutTokensInput = { @@ -369,6 +391,7 @@ export type usersUncheckedCreateWithoutTokensInput = { password: string createdAt?: Date | string updatedAt: Date | string + rides?: Prisma.ridesUncheckedCreateNestedManyWithoutUsersInput } export type usersCreateOrConnectWithoutTokensInput = { @@ -394,6 +417,7 @@ export type usersUpdateWithoutTokensInput = { password?: Prisma.StringFieldUpdateOperationsInput | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rides?: Prisma.ridesUpdateManyWithoutUsersNestedInput } export type usersUncheckedUpdateWithoutTokensInput = { @@ -403,6 +427,63 @@ export type usersUncheckedUpdateWithoutTokensInput = { password?: Prisma.StringFieldUpdateOperationsInput | string createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rides?: Prisma.ridesUncheckedUpdateManyWithoutUsersNestedInput +} + +export type usersCreateWithoutRidesInput = { + id: string + name: string + email: string + password: string + createdAt?: Date | string + updatedAt: Date | string + tokens?: Prisma.tokensCreateNestedManyWithoutUsersInput +} + +export type usersUncheckedCreateWithoutRidesInput = { + id: string + name: string + email: string + password: string + createdAt?: Date | string + updatedAt: Date | string + tokens?: Prisma.tokensUncheckedCreateNestedManyWithoutUsersInput +} + +export type usersCreateOrConnectWithoutRidesInput = { + where: Prisma.usersWhereUniqueInput + create: Prisma.XOR +} + +export type usersUpsertWithoutRidesInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.usersWhereInput +} + +export type usersUpdateToOneWithWhereWithoutRidesInput = { + where?: Prisma.usersWhereInput + data: Prisma.XOR +} + +export type usersUpdateWithoutRidesInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tokens?: Prisma.tokensUpdateManyWithoutUsersNestedInput +} + +export type usersUncheckedUpdateWithoutRidesInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + tokens?: Prisma.tokensUncheckedUpdateManyWithoutUsersNestedInput } @@ -411,10 +492,12 @@ export type usersUncheckedUpdateWithoutTokensInput = { */ export type UsersCountOutputType = { + rides: number tokens: number } export type UsersCountOutputTypeSelect = { + rides?: boolean | UsersCountOutputTypeCountRidesArgs tokens?: boolean | UsersCountOutputTypeCountTokensArgs } @@ -428,6 +511,13 @@ export type UsersCountOutputTypeDefaultArgs | null } +/** + * UsersCountOutputType without action + */ +export type UsersCountOutputTypeCountRidesArgs = { + where?: Prisma.ridesWhereInput +} + /** * UsersCountOutputType without action */ @@ -443,6 +533,7 @@ export type usersSelect tokens?: boolean | Prisma.users$tokensArgs _count?: boolean | Prisma.UsersCountOutputTypeDefaultArgs }, ExtArgs["result"]["users"]> @@ -476,6 +567,7 @@ export type usersSelectScalar = { export type usersOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "email" | "password" | "createdAt" | "updatedAt", ExtArgs["result"]["users"]> export type usersInclude = { + rides?: boolean | Prisma.users$ridesArgs tokens?: boolean | Prisma.users$tokensArgs _count?: boolean | Prisma.UsersCountOutputTypeDefaultArgs } @@ -485,6 +577,7 @@ export type usersIncludeUpdateManyAndReturn = { name: "users" objects: { + rides: Prisma.$ridesPayload[] tokens: Prisma.$tokensPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ @@ -888,6 +981,7 @@ readonly fields: usersFieldRefs; */ export interface Prisma__usersClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" + rides = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> tokens = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. @@ -1316,6 +1410,30 @@ export type usersDeleteManyArgs = { + /** + * Select specific fields to fetch from the rides + */ + select?: Prisma.ridesSelect | null + /** + * Omit specific fields from the rides + */ + omit?: Prisma.ridesOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ridesInclude | null + where?: Prisma.ridesWhereInput + orderBy?: Prisma.ridesOrderByWithRelationInput | Prisma.ridesOrderByWithRelationInput[] + cursor?: Prisma.ridesWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.RidesScalarFieldEnum | Prisma.RidesScalarFieldEnum[] +} + /** * users.tokens */ diff --git a/backend/src/repositories/companies.repository.ts b/backend/src/repositories/companies.repository.ts new file mode 100644 index 0000000..64db4cb --- /dev/null +++ b/backend/src/repositories/companies.repository.ts @@ -0,0 +1,50 @@ +import prisma from '../lib/prisma.js'; + +export async function findCompanyById(id: string) { + return prisma.companies.findUnique({ where: { id } }); +} + +export async function createCompany(data: { + id: string; + name: string; + cost_per_km: any; + notes?: string; +}) { + return prisma.companies.create({ data }); +} + +export async function updateCompany( + id: string, + data: Partial<{ + name: string; + cost_per_km: any; + notes: string; + }> +) { + return prisma.companies.update({ where: { id }, data }); +} + +export async function deleteCompany(id: string) { + return prisma.companies.delete({ where: { id } }); +} + +export async function listCompanies() { + return prisma.companies.findMany(); +} + +export async function upsertCompany(data: { + id: string; + name: string; + cost_per_km: any; + notes?: string; +}) { + return prisma.companies.upsert({ + where: { id: data.id }, + update: { + name: data.name, + cost_per_km: data.cost_per_km, + notes: data.notes, + }, + create: data, + }); +} diff --git a/backend/src/repositories/rides.repository.ts b/backend/src/repositories/rides.repository.ts new file mode 100644 index 0000000..b07dba9 --- /dev/null +++ b/backend/src/repositories/rides.repository.ts @@ -0,0 +1,82 @@ +import prisma from '../lib/prisma.js'; + +export async function findRideById(id: string) { + return prisma.rides.findUnique({ where: { id } }); +} + +export async function createRide(data: { + id: string; + user_id: string; + company: string; + km: any; + cost_per_km: any; + total: any; + ride_date: string; + synced?: number; +}) { + return prisma.rides.create({ data }); +} + +export async function updateRide( + id: string, + data: Partial<{ + user_id: string; + company: string; + km: any; + cost_per_km: any; + total: any; + ride_date: string; + synced: number; + }> +) { + return prisma.rides.update({ where: { id }, data }); +} + +export async function deleteRide(id: string) { + return prisma.rides.delete({ where: { id } }); +} + +export async function listRidesByUserId(user_id: string) { + return prisma.rides.findMany({ where: { user_id } }); +} + +export async function listRidesNotSynced(user_id: string) { + return prisma.rides.findMany({ + where: { + user_id, + synced: 0, + }, + }); +} + +export async function markRideAsSynced(id: string) { + return prisma.rides.update({ + where: { id }, + data: { synced: 1 }, + }); +} + +export async function upsertRide(data: { + id: string; + user_id: string; + company: string; + km: any; + cost_per_km: any; + total: any; + ride_date: string; + synced?: number; +}) { + return prisma.rides.upsert({ + where: { id: data.id }, + update: { + user_id: data.user_id, + company: data.company, + km: data.km, + cost_per_km: data.cost_per_km, + total: data.total, + ride_date: data.ride_date, + synced: data.synced, + }, + create: data, + }); +} diff --git a/backend/src/routes/sync.routes.ts b/backend/src/routes/sync.routes.ts new file mode 100644 index 0000000..057e229 --- /dev/null +++ b/backend/src/routes/sync.routes.ts @@ -0,0 +1,9 @@ +import { Router } from 'express'; +import * as syncController from '../controllers/sync.controller.js'; + +const router = Router(); + +router.post('/companies', syncController.syncCompanies); +router.post('/rides', syncController.syncRides); + +export default router; diff --git a/backend/src/server.ts b/backend/src/server.ts index e0210be..110acdb 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -2,6 +2,7 @@ import express from 'express'; import cors from 'cors'; import authRoutes from './routes/auth.routes.js'; import usersRoutes from './routes/users.routes.js'; +import syncRoutes from './routes/sync.routes.js'; const app = express(); const port = process.env.PORT ? Number(process.env.PORT) : 4000; @@ -11,6 +12,7 @@ app.use(express.json()); app.use('/auth', authRoutes); app.use('/users', usersRoutes); +app.use('/sync', syncRoutes); app.listen(port, '0.0.0.0', () => { console.log(`Server is running on port ${port}`); diff --git a/backend/src/services/sync.service.ts b/backend/src/services/sync.service.ts new file mode 100644 index 0000000..462052a --- /dev/null +++ b/backend/src/services/sync.service.ts @@ -0,0 +1,66 @@ +import { z } from 'zod'; +import * as companiesRepo from '../repositories/companies.repository.js'; +import * as ridesRepo from '../repositories/rides.repository.js'; + +// Validation schemas +export const syncCompaniesSchema = z.object({ + companies: z.array( + z.object({ + id: z.string(), + name: z.string(), + cost_per_km: z.number().or(z.string()), + notes: z.string().optional(), + }) + ), +}); + +export const syncRidesSchema = z.object({ + rides: z.array( + z.object({ + id: z.string(), + user_id: z.string(), + company: z.string(), + km: z.number().or(z.string()), + cost_per_km: z.number().or(z.string()), + total: z.number().or(z.string()), + ride_date: z.string(), + synced: z.number().optional(), + }) + ), +}); + +export async function syncCompanies( + input: z.infer +) { + const synced = []; + for (const company of input.companies) { + const result = await companiesRepo.upsertCompany({ + id: company.id, + name: company.name, + cost_per_km: company.cost_per_km, + notes: company.notes, + }); + synced.push(result); + } + return synced; +} + +export async function syncRides( + input: z.infer +) { + const synced = []; + for (const ride of input.rides) { + const result = await ridesRepo.upsertRide({ + id: ride.id, + user_id: ride.user_id, + company: ride.company, + km: ride.km, + cost_per_km: ride.cost_per_km, + total: ride.total, + ride_date: ride.ride_date, + synced: ride.synced, + }); + synced.push(result); + } + return synced; +} diff --git a/toptran-app/database/create_tables.sql b/toptran-app/database/create_tables.sql index 3cf6d4d..abe3255 100644 --- a/toptran-app/database/create_tables.sql +++ b/toptran-app/database/create_tables.sql @@ -1,36 +1,51 @@ -- ============================================================ --- TopTran β€” Script de criaΓ§Γ£o das tabelas no PostgreSQL +-- TopTran β€” PostgreSQL table creation script +-- ============================================================ +-- NOTE: The "users" table already exists with the schema below. +-- Do NOT run the commented block if it already exists. -- ============================================================ -CREATE TABLE IF NOT EXISTS empresas ( - id TEXT PRIMARY KEY, - nome TEXT NOT NULL, - custo_por_km NUMERIC(10,2) NOT NULL, - observacoes TEXT DEFAULT '', - created_at TIMESTAMPTZ DEFAULT NOW() -); +-- [EXISTING TABLE β€” DO NOT RECREATE] +-- CREATE TABLE IF NOT EXISTS users ( +-- id TEXT PRIMARY KEY, +-- name TEXT NOT NULL, +-- email TEXT NOT NULL UNIQUE, +-- password TEXT NOT NULL, +-- "createdAt" TIMESTAMPTZ DEFAULT NOW(), +-- "updatedAt" TIMESTAMPTZ DEFAULT NOW() +-- ); -CREATE TABLE IF NOT EXISTS usuarios ( - id TEXT PRIMARY KEY, - email TEXT NOT NULL UNIQUE, - name TEXT NOT NULL, - token TEXT, - created_at TIMESTAMPTZ DEFAULT NOW() -); - -CREATE TABLE IF NOT EXISTS corridas ( +-- ============================================================ +-- Companies +-- ============================================================ +CREATE TABLE IF NOT EXISTS companies ( id TEXT PRIMARY KEY, - usuario_id TEXT NOT NULL REFERENCES usuarios(id) ON DELETE CASCADE, - empresa TEXT NOT NULL, - km NUMERIC(10,2) NOT NULL, - custo_por_km NUMERIC(10,2) NOT NULL, - total NUMERIC(10,2) NOT NULL, - data TEXT NOT NULL, - sincronizado SMALLINT DEFAULT 0, - created_at TIMESTAMPTZ DEFAULT NOW() + name TEXT NOT NULL, + cost_per_km NUMERIC(10,2) NOT NULL, + notes TEXT DEFAULT '', + "createdAt" TIMESTAMPTZ DEFAULT NOW(), + "updatedAt" TIMESTAMPTZ DEFAULT NOW() ); --- Índices para performance -CREATE INDEX IF NOT EXISTS idx_corridas_usuario_id ON corridas(usuario_id); -CREATE INDEX IF NOT EXISTS idx_corridas_sincronizado ON corridas(sincronizado); -CREATE INDEX IF NOT EXISTS idx_usuarios_email ON usuarios(email); +-- ============================================================ +-- Rides +-- ============================================================ +CREATE TABLE IF NOT EXISTS rides ( + id TEXT PRIMARY KEY, + user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE, + company TEXT NOT NULL, + km NUMERIC(10,2) NOT NULL, + cost_per_km NUMERIC(10,2) NOT NULL, + total NUMERIC(10,2) NOT NULL, + ride_date TEXT NOT NULL, + synced SMALLINT DEFAULT 0, + "createdAt" TIMESTAMPTZ DEFAULT NOW(), + "updatedAt" TIMESTAMPTZ DEFAULT NOW() +); + +-- ============================================================ +-- Indexes +-- ============================================================ +CREATE INDEX IF NOT EXISTS idx_rides_user_id ON rides(user_id); +CREATE INDEX IF NOT EXISTS idx_rides_synced ON rides(synced); +CREATE INDEX IF NOT EXISTS idx_companies_name ON companies(name); diff --git a/toptran-app/src/app/sincronizar.tsx b/toptran-app/src/app/sincronizar.tsx index 4a7806f..e7d8538 100644 --- a/toptran-app/src/app/sincronizar.tsx +++ b/toptran-app/src/app/sincronizar.tsx @@ -4,7 +4,6 @@ import { marcarCorridaComoSincronizada, obterCorridasNaoSincronizadas, obterEmpresas, - obterUsuario, } from "@/services/db"; import { api } from "@/server/api"; import { router } from "expo-router"; @@ -37,13 +36,6 @@ const INITIAL_ITEMS: SyncItem[] = [ status: "pending", detail: "", }, - { - key: "usuarios", - label: "UsuΓ‘rios", - description: "Dados do usuΓ‘rio autenticado", - status: "pending", - detail: "", - }, { key: "corridas", label: "Corridas", @@ -75,14 +67,14 @@ export default function SincronizarPage() { setDone(false); setItems(INITIAL_ITEMS); - // ── Empresas ──────────────────────────────────────────── + // ── Companies ──────────────────────────────────────────── update("empresas", { status: "syncing" }); try { - const empresas = await obterEmpresas(); - await api.post("/sync/empresas", { empresas }); + const companies = await obterEmpresas(); + await api.post("/sync/companies", { companies }); update("empresas", { status: "success", - detail: `${empresas.length} registro${empresas.length !== 1 ? "s" : ""} enviado${empresas.length !== 1 ? "s" : ""}`, + detail: `${companies.length} registro${companies.length !== 1 ? "s" : ""} enviado${companies.length !== 1 ? "s" : ""}`, }); } catch (e: any) { update("empresas", { @@ -91,37 +83,20 @@ export default function SincronizarPage() { }); } - // ── UsuΓ‘rios ───────────────────────────────────────────── - update("usuarios", { status: "syncing" }); - try { - const usuario = await obterUsuario(user.id); - if (usuario) { - await api.post("/sync/usuarios", { usuarios: [usuario] }); - update("usuarios", { status: "success", detail: "1 registro enviado" }); - } else { - update("usuarios", { status: "error", detail: "UsuΓ‘rio nΓ£o encontrado" }); - } - } catch (e: any) { - update("usuarios", { - status: "error", - detail: e?.response?.data?.error ?? e?.message ?? "Falha na conexΓ£o", - }); - } - - // ── Corridass ───────────────────────────────────────────── + // ── Rides ───────────────────────────────────────────────── update("corridas", { status: "syncing" }); try { - const corridas = await obterCorridasNaoSincronizadas(user.id); - if (corridas.length === 0) { + const rides = await obterCorridasNaoSincronizadas(user.id); + if (rides.length === 0) { update("corridas", { status: "success", detail: "Nenhuma corrida pendente" }); } else { - await api.post("/sync/corridas", { corridas }); - for (const c of corridas) { - await marcarCorridaComoSincronizada(c.id); + await api.post("/sync/rides", { rides }); + for (const ride of rides) { + await marcarCorridaComoSincronizada(ride.id); } update("corridas", { status: "success", - detail: `${corridas.length} corrida${corridas.length !== 1 ? "s" : ""} enviada${corridas.length !== 1 ? "s" : ""}`, + detail: `${rides.length} corrida${rides.length !== 1 ? "s" : ""} enviada${rides.length !== 1 ? "s" : ""}`, }); } } catch (e: any) {