Added mutations and queries for DaiailyStats and TotalStats. Updated Schema. Added scalar package.

This commit is contained in:
2025-11-11 20:17:14 -05:00
parent ff334a7f0d
commit 834900f9bb
25 changed files with 2483 additions and 4532 deletions
+10 -5
View File
@@ -1,23 +1,28 @@
"use client";
import { Provider } from "@/components/ui/provider";
import { UrqlProvider, ssrExchange, cacheExchange, fetchExchange, createClient } from '@urql/next';
import { useMemo } from "react";
import {
UrqlProvider,
ssrExchange,
cacheExchange,
fetchExchange,
createClient
} from "@urql/next";
import React, { useMemo } from "react";
export default function RootLayout({
children
}: Readonly<{
children: React.ReactNode;
}>) {
const [client, ssr] = useMemo(() => {
const ssr = ssrExchange({
isClient: typeof window !== 'undefined',
isClient: typeof window !== "undefined"
});
const client = createClient({
url: process.env.NEXT_PUBLIC_GRAPHQL_URL || "",
exchanges: [cacheExchange, ssr, fetchExchange],
suspense: true,
suspense: true
});
return [client, ssr];
-1
View File
@@ -6,7 +6,6 @@ import { Icon } from "@iconify/react";
import { useQuery } from "@urql/next";
import { Fragment } from "react/jsx-runtime";
export default function Home() {
const [{ fetching, data, error }] = useQuery({ query: GetTotalGroupsQuery });
+1
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
"use client";
import type { IconButtonProps, SpanProps } from "@chakra-ui/react";
+123 -2
View File
@@ -1,23 +1,144 @@
import prisma from "@/lib/prismaClient";
import { BigIntResolver } from "graphql-scalars";
// Prisma
export const resolvers = {
// scalars
BigInt: BigIntResolver,
Query: {
getTotalGroups: () => prisma.group.count()
getTotalGroups: async () => await prisma.groups.count(),
getTodayStats: async () =>
await prisma.dailyStats.findFirst({
orderBy: {
createdAt: "desc"
}
}),
getStatsRange: async (
_parent: unknown,
data: { startDate: Date; endDate: Date }
// _ctx: unknown
) => {
const { startDate, endDate } = data;
return await prisma.dailyStats.findMany({
where: {
createdAt: {
gt: startDate,
lte: endDate
}
},
orderBy: {
createdAt: "asc"
}
});
},
getTotalStats: async () =>
await prisma.totalStats.findFirst({
orderBy: {
createdAt: "asc"
}
})
},
Mutation: {
init: async () =>
// _parent: unknown,
// data: { newWeek: boolean; newMonth: boolean }
// _ctx: unknown
{
const date = new Date().toISOString();
let count = 0;
if ((await prisma.dailyStats.count()) === 0) {
await prisma.dailyStats.create({ data: { createdAt: date } });
count++;
}
if ((await prisma.totalStats.count()) === 0) {
await prisma.totalStats.create({ data: { createdAt: date } });
count++;
}
return `${count} tables have been initialized with data.`;
},
cronJob: async () =>
// _parent: unknown,
// data: { newWeek: boolean; newMonth: boolean }
// _ctx: unknown
{
const date = new Date().toISOString();
await prisma.dailyStats.create({ data: { createdAt: date } });
const allStats = await prisma.dailyStats.findMany({});
const calculatedStats = allStats.reduce(
(acc, curr) => {
const links = (acc.linksDeleted += curr.linksDeleted);
const commands = (acc.commandResponses += curr.commandResponses);
const triggers = (acc.timesTriggered += curr.timesTriggered);
return {
linksDeleted: links,
commandResponses: commands,
timesTriggered: triggers
};
},
{
linksDeleted: 0,
commandResponses: 0,
timesTriggered: 0
}
);
const totalStats = await prisma.totalStats.findFirst({
orderBy: {
createdAt: "desc"
}
});
return await prisma.totalStats.update({
where: {
createdAt: totalStats?.createdAt
},
data: {
...calculatedStats
}
});
},
addGroup: async (
_parent: unknown,
data: { groupID: number; groupName: string }
// _ctx: unknown
) => {
const { groupID, groupName } = data;
return await prisma.group.create({
return await prisma.groups.create({
data: {
telegramID: groupID,
name: groupName
}
});
},
increment: async (
_parent: unknown,
data: { link: boolean; command: boolean; trigger: boolean }
// _ctx: unknown
) => {
const { link, command, trigger } = data;
return await prisma.dailyStats
.findFirst({
orderBy: {
createdAt: "desc"
}
})
.then(async (todayStat) => {
return await prisma.dailyStats.update({
where: { createdAt: todayStat?.createdAt },
data: {
linksDeleted: { increment: link ? 1 : 0 },
commandResponses: { increment: command ? 1 : 0 },
timesTriggered: { increment: trigger ? 1 : 0 }
}
});
});
}
}
};
+28 -3
View File
@@ -1,16 +1,41 @@
import { BigIntTypeDefinition } from "graphql-scalars";
const typeDefs = /* GraphQL */ `
${BigIntTypeDefinition}
scalar Date
type Query {
getTotalGroups: Int!
getTodayStats: DailyStats!
getStatsRange(startDate: Date, endDate: Date): [DailyStats]
getTotalStats: TotalStats!
}
type Mutation {
addGroup(groupID: Int, groupName: String): Group!
init: String!
cronJob: TotalStats!
addGroup(groupID: Int, groupName: String): Groups!
increment(link: Boolean, command: Boolean, trigger: Boolean): DailyStats!
}
type Group {
type Groups {
telegramID: Int
name: String
createdAt: Date
updatedAt: Date
}
scalar Date
type TotalStats {
createdAt: String
updatedAt: Date
linksDeleted: BigInt
commandResponses: BigInt
timesTriggered: BigInt
}
type DailyStats {
createdAt: String
updatedAt: Date
linksDeleted: Int
commandResponses: Int
timesTriggered: Int
}
`;
export default typeDefs;
+3 -12
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file should be your main import to use Prisma-related types and utilities in a browser.
@@ -17,10 +18,10 @@ export { Prisma }
export * as $Enums from './enums'
export * from './enums';
/**
* Model Group
* Model Groups
*
*/
export type Group = Prisma.GroupModel
export type Groups = Prisma.GroupsModel
/**
* Model TotalStats
*
@@ -31,13 +32,3 @@ export type TotalStats = Prisma.TotalStatsModel
*
*/
export type DailyStats = Prisma.DailyStatsModel
/**
* Model WeeklyStats
*
*/
export type WeeklyStats = Prisma.WeeklyStatsModel
/**
* Model MonthlyStats
*
*/
export type MonthlyStats = Prisma.MonthlyStatsModel
+4 -13
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
@@ -29,7 +30,7 @@ export * from "./enums"
* ```
* const prisma = new PrismaClient()
* // Fetch zero or more Groups
* const groups = await prisma.group.findMany()
* const groups = await prisma.groups.findMany()
* ```
*
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
@@ -44,10 +45,10 @@ path.join(__dirname, "libquery_engine-debian-openssl-3.0.x.so.node")
path.join(process.cwd(), "src/prisma/generated/libquery_engine-debian-openssl-3.0.x.so.node")
/**
* Model Group
* Model Groups
*
*/
export type Group = Prisma.GroupModel
export type Groups = Prisma.GroupsModel
/**
* Model TotalStats
*
@@ -58,13 +59,3 @@ export type TotalStats = Prisma.TotalStatsModel
*
*/
export type DailyStats = Prisma.DailyStatsModel
/**
* Model WeeklyStats
*
*/
export type WeeklyStats = Prisma.WeeklyStatsModel
/**
* Model MonthlyStats
*
*/
export type MonthlyStats = Prisma.MonthlyStatsModel
+1
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports various common sort, input & filter types that are not directly linked to a particular model.
+1
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports all enum related types from the schema.
File diff suppressed because one or more lines are too long
+43 -216
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* WARNING: This is an internal file that is subject to change!
@@ -87,12 +88,12 @@ export type PrismaVersion = {
}
/**
* Prisma Client JS version: 6.18.0
* Query Engine version: 34b5a692b7bd79939a9a2c3ef97d816e749cda2f
* Prisma Client JS version: 6.19.0
* Query Engine version: 2ba551f319ab1df4bc874a89965d8b3641056773
*/
export const prismaVersion: PrismaVersion = {
client: "6.18.0",
engine: "34b5a692b7bd79939a9a2c3ef97d816e749cda2f"
client: "6.19.0",
engine: "2ba551f319ab1df4bc874a89965d8b3641056773"
}
/**
@@ -389,11 +390,9 @@ type FieldRefInputType<Model, FieldType> = Model extends never ? never : FieldRe
export const ModelName = {
Group: 'Group',
Groups: 'Groups',
TotalStats: 'TotalStats',
DailyStats: 'DailyStats',
WeeklyStats: 'WeeklyStats',
MonthlyStats: 'MonthlyStats'
DailyStats: 'DailyStats'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -409,81 +408,81 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "group" | "totalStats" | "dailyStats" | "weeklyStats" | "monthlyStats"
modelProps: "groups" | "totalStats" | "dailyStats"
txIsolationLevel: never
}
model: {
Group: {
payload: Prisma.$GroupPayload<ExtArgs>
fields: Prisma.GroupFieldRefs
Groups: {
payload: Prisma.$GroupsPayload<ExtArgs>
fields: Prisma.GroupsFieldRefs
operations: {
findUnique: {
args: Prisma.GroupFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload> | null
args: Prisma.GroupsFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload> | null
}
findUniqueOrThrow: {
args: Prisma.GroupFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
findFirst: {
args: Prisma.GroupFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload> | null
args: Prisma.GroupsFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload> | null
}
findFirstOrThrow: {
args: Prisma.GroupFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
findMany: {
args: Prisma.GroupFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>[]
args: Prisma.GroupsFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>[]
}
create: {
args: Prisma.GroupCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
createMany: {
args: Prisma.GroupCreateManyArgs<ExtArgs>
args: Prisma.GroupsCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.GroupDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
update: {
args: Prisma.GroupUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
deleteMany: {
args: Prisma.GroupDeleteManyArgs<ExtArgs>
args: Prisma.GroupsDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.GroupUpdateManyArgs<ExtArgs>
args: Prisma.GroupsUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.GroupUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupPayload>
args: Prisma.GroupsUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$GroupsPayload>
}
aggregate: {
args: Prisma.GroupAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateGroup>
args: Prisma.GroupsAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateGroups>
}
groupBy: {
args: Prisma.GroupGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.GroupGroupByOutputType>[]
args: Prisma.GroupsGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.GroupsGroupByOutputType>[]
}
findRaw: {
args: Prisma.GroupFindRawArgs<ExtArgs>
args: Prisma.GroupsFindRawArgs<ExtArgs>
result: Prisma.JsonObject
}
aggregateRaw: {
args: Prisma.GroupAggregateRawArgs<ExtArgs>
args: Prisma.GroupsAggregateRawArgs<ExtArgs>
result: Prisma.JsonObject
}
count: {
args: Prisma.GroupCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.GroupCountAggregateOutputType> | number
args: Prisma.GroupsCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.GroupsCountAggregateOutputType> | number
}
}
}
@@ -635,154 +634,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
WeeklyStats: {
payload: Prisma.$WeeklyStatsPayload<ExtArgs>
fields: Prisma.WeeklyStatsFieldRefs
operations: {
findUnique: {
args: Prisma.WeeklyStatsFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload> | null
}
findUniqueOrThrow: {
args: Prisma.WeeklyStatsFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
findFirst: {
args: Prisma.WeeklyStatsFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload> | null
}
findFirstOrThrow: {
args: Prisma.WeeklyStatsFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
findMany: {
args: Prisma.WeeklyStatsFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>[]
}
create: {
args: Prisma.WeeklyStatsCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
createMany: {
args: Prisma.WeeklyStatsCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.WeeklyStatsDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
update: {
args: Prisma.WeeklyStatsUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
deleteMany: {
args: Prisma.WeeklyStatsDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.WeeklyStatsUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.WeeklyStatsUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$WeeklyStatsPayload>
}
aggregate: {
args: Prisma.WeeklyStatsAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateWeeklyStats>
}
groupBy: {
args: Prisma.WeeklyStatsGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.WeeklyStatsGroupByOutputType>[]
}
findRaw: {
args: Prisma.WeeklyStatsFindRawArgs<ExtArgs>
result: Prisma.JsonObject
}
aggregateRaw: {
args: Prisma.WeeklyStatsAggregateRawArgs<ExtArgs>
result: Prisma.JsonObject
}
count: {
args: Prisma.WeeklyStatsCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.WeeklyStatsCountAggregateOutputType> | number
}
}
}
MonthlyStats: {
payload: Prisma.$MonthlyStatsPayload<ExtArgs>
fields: Prisma.MonthlyStatsFieldRefs
operations: {
findUnique: {
args: Prisma.MonthlyStatsFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload> | null
}
findUniqueOrThrow: {
args: Prisma.MonthlyStatsFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
findFirst: {
args: Prisma.MonthlyStatsFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload> | null
}
findFirstOrThrow: {
args: Prisma.MonthlyStatsFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
findMany: {
args: Prisma.MonthlyStatsFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>[]
}
create: {
args: Prisma.MonthlyStatsCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
createMany: {
args: Prisma.MonthlyStatsCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.MonthlyStatsDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
update: {
args: Prisma.MonthlyStatsUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
deleteMany: {
args: Prisma.MonthlyStatsDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.MonthlyStatsUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.MonthlyStatsUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$MonthlyStatsPayload>
}
aggregate: {
args: Prisma.MonthlyStatsAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateMonthlyStats>
}
groupBy: {
args: Prisma.MonthlyStatsGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.MonthlyStatsGroupByOutputType>[]
}
findRaw: {
args: Prisma.MonthlyStatsFindRawArgs<ExtArgs>
result: Prisma.JsonObject
}
aggregateRaw: {
args: Prisma.MonthlyStatsAggregateRawArgs<ExtArgs>
result: Prisma.JsonObject
}
count: {
args: Prisma.MonthlyStatsCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.MonthlyStatsCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
@@ -800,14 +651,14 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
* Enums
*/
export const GroupScalarFieldEnum = {
export const GroupsScalarFieldEnum = {
telegramID: 'telegramID',
name: 'name',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type GroupScalarFieldEnum = (typeof GroupScalarFieldEnum)[keyof typeof GroupScalarFieldEnum]
export type GroupsScalarFieldEnum = (typeof GroupsScalarFieldEnum)[keyof typeof GroupsScalarFieldEnum]
export const TotalStatsScalarFieldEnum = {
@@ -832,28 +683,6 @@ export const DailyStatsScalarFieldEnum = {
export type DailyStatsScalarFieldEnum = (typeof DailyStatsScalarFieldEnum)[keyof typeof DailyStatsScalarFieldEnum]
export const WeeklyStatsScalarFieldEnum = {
createdAt: 'createdAt',
updatedAt: 'updatedAt',
linksDeleted: 'linksDeleted',
commandResponses: 'commandResponses',
timesTriggered: 'timesTriggered'
} as const
export type WeeklyStatsScalarFieldEnum = (typeof WeeklyStatsScalarFieldEnum)[keyof typeof WeeklyStatsScalarFieldEnum]
export const MonthlyStatsScalarFieldEnum = {
createdAt: 'createdAt',
updatedAt: 'updatedAt',
linksDeleted: 'linksDeleted',
commandResponses: 'commandResponses',
timesTriggered: 'timesTriggered'
} as const
export type MonthlyStatsScalarFieldEnum = (typeof MonthlyStatsScalarFieldEnum)[keyof typeof MonthlyStatsScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
@@ -1031,11 +860,9 @@ export interface PrismaClientOptions {
omit?: GlobalOmitConfig
}
export type GlobalOmitConfig = {
group?: Prisma.GroupOmit
groups?: Prisma.GroupsOmit
totalStats?: Prisma.TotalStatsOmit
dailyStats?: Prisma.DailyStatsOmit
weeklyStats?: Prisma.WeeklyStatsOmit
monthlyStats?: Prisma.MonthlyStatsOmit
}
/* Types for Logging */
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* WARNING: This is an internal file that is subject to change!
@@ -48,11 +49,9 @@ export const AnyNull = runtime.objectEnumValues.instances.AnyNull
export const ModelName = {
Group: 'Group',
Groups: 'Groups',
TotalStats: 'TotalStats',
DailyStats: 'DailyStats',
WeeklyStats: 'WeeklyStats',
MonthlyStats: 'MonthlyStats'
DailyStats: 'DailyStats'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -61,14 +60,14 @@ export type ModelName = (typeof ModelName)[keyof typeof ModelName]
* Enums
*/
export const GroupScalarFieldEnum = {
export const GroupsScalarFieldEnum = {
telegramID: 'telegramID',
name: 'name',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type GroupScalarFieldEnum = (typeof GroupScalarFieldEnum)[keyof typeof GroupScalarFieldEnum]
export type GroupsScalarFieldEnum = (typeof GroupsScalarFieldEnum)[keyof typeof GroupsScalarFieldEnum]
export const TotalStatsScalarFieldEnum = {
@@ -93,28 +92,6 @@ export const DailyStatsScalarFieldEnum = {
export type DailyStatsScalarFieldEnum = (typeof DailyStatsScalarFieldEnum)[keyof typeof DailyStatsScalarFieldEnum]
export const WeeklyStatsScalarFieldEnum = {
createdAt: 'createdAt',
updatedAt: 'updatedAt',
linksDeleted: 'linksDeleted',
commandResponses: 'commandResponses',
timesTriggered: 'timesTriggered'
} as const
export type WeeklyStatsScalarFieldEnum = (typeof WeeklyStatsScalarFieldEnum)[keyof typeof WeeklyStatsScalarFieldEnum]
export const MonthlyStatsScalarFieldEnum = {
createdAt: 'createdAt',
updatedAt: 'updatedAt',
linksDeleted: 'linksDeleted',
commandResponses: 'commandResponses',
timesTriggered: 'timesTriggered'
} as const
export type MonthlyStatsScalarFieldEnum = (typeof MonthlyStatsScalarFieldEnum)[keyof typeof MonthlyStatsScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'
+2 -3
View File
@@ -1,15 +1,14 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This is a barrel export file for all models and their related types.
*
* 🟢 You can import this file directly.
*/
export type * from './models/Group'
export type * from './models/Groups'
export type * from './models/TotalStats'
export type * from './models/DailyStats'
export type * from './models/WeeklyStats'
export type * from './models/MonthlyStats'
export type * from './commonInputTypes'
+57 -48
View File
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `DailyStats` model and its related types.
@@ -32,25 +33,25 @@ export type DailyStatsAvgAggregateOutputType = {
}
export type DailyStatsSumAggregateOutputType = {
linksDeleted: bigint | null
commandResponses: bigint | null
timesTriggered: bigint | null
linksDeleted: number | null
commandResponses: number | null
timesTriggered: number | null
}
export type DailyStatsMinAggregateOutputType = {
createdAt: Date | null
updatedAt: Date | null
linksDeleted: bigint | null
commandResponses: bigint | null
timesTriggered: bigint | null
linksDeleted: number | null
commandResponses: number | null
timesTriggered: number | null
}
export type DailyStatsMaxAggregateOutputType = {
createdAt: Date | null
updatedAt: Date | null
linksDeleted: bigint | null
commandResponses: bigint | null
timesTriggered: bigint | null
linksDeleted: number | null
commandResponses: number | null
timesTriggered: number | null
}
export type DailyStatsCountAggregateOutputType = {
@@ -189,9 +190,9 @@ export type DailyStatsGroupByArgs<ExtArgs extends runtime.Types.Extensions.Inter
export type DailyStatsGroupByOutputType = {
createdAt: Date
updatedAt: Date
linksDeleted: bigint
commandResponses: bigint
timesTriggered: bigint
linksDeleted: number
commandResponses: number
timesTriggered: number
_count: DailyStatsCountAggregateOutputType | null
_avg: DailyStatsAvgAggregateOutputType | null
_sum: DailyStatsSumAggregateOutputType | null
@@ -220,9 +221,9 @@ export type DailyStatsWhereInput = {
NOT?: Prisma.DailyStatsWhereInput | Prisma.DailyStatsWhereInput[]
createdAt?: Prisma.DateTimeFilter<"DailyStats"> | Date | string
updatedAt?: Prisma.DateTimeFilter<"DailyStats"> | Date | string
linksDeleted?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
commandResponses?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
timesTriggered?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
linksDeleted?: Prisma.IntFilter<"DailyStats"> | number
commandResponses?: Prisma.IntFilter<"DailyStats"> | number
timesTriggered?: Prisma.IntFilter<"DailyStats"> | number
}
export type DailyStatsOrderByWithRelationInput = {
@@ -239,9 +240,9 @@ export type DailyStatsWhereUniqueInput = Prisma.AtLeast<{
OR?: Prisma.DailyStatsWhereInput[]
NOT?: Prisma.DailyStatsWhereInput | Prisma.DailyStatsWhereInput[]
updatedAt?: Prisma.DateTimeFilter<"DailyStats"> | Date | string
linksDeleted?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
commandResponses?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
timesTriggered?: Prisma.BigIntFilter<"DailyStats"> | bigint | number
linksDeleted?: Prisma.IntFilter<"DailyStats"> | number
commandResponses?: Prisma.IntFilter<"DailyStats"> | number
timesTriggered?: Prisma.IntFilter<"DailyStats"> | number
}, "createdAt">
export type DailyStatsOrderByWithAggregationInput = {
@@ -263,61 +264,61 @@ export type DailyStatsScalarWhereWithAggregatesInput = {
NOT?: Prisma.DailyStatsScalarWhereWithAggregatesInput | Prisma.DailyStatsScalarWhereWithAggregatesInput[]
createdAt?: Prisma.DateTimeWithAggregatesFilter<"DailyStats"> | Date | string
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"DailyStats"> | Date | string
linksDeleted?: Prisma.BigIntWithAggregatesFilter<"DailyStats"> | bigint | number
commandResponses?: Prisma.BigIntWithAggregatesFilter<"DailyStats"> | bigint | number
timesTriggered?: Prisma.BigIntWithAggregatesFilter<"DailyStats"> | bigint | number
linksDeleted?: Prisma.IntWithAggregatesFilter<"DailyStats"> | number
commandResponses?: Prisma.IntWithAggregatesFilter<"DailyStats"> | number
timesTriggered?: Prisma.IntWithAggregatesFilter<"DailyStats"> | number
}
export type DailyStatsCreateInput = {
createdAt?: Date | string
updatedAt?: Date | string
linksDeleted?: bigint | number
commandResponses?: bigint | number
timesTriggered?: bigint | number
linksDeleted?: number
commandResponses?: number
timesTriggered?: number
}
export type DailyStatsUncheckedCreateInput = {
createdAt?: Date | string
updatedAt?: Date | string
linksDeleted?: bigint | number
commandResponses?: bigint | number
timesTriggered?: bigint | number
linksDeleted?: number
commandResponses?: number
timesTriggered?: number
}
export type DailyStatsUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
linksDeleted?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
commandResponses?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
timesTriggered?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
linksDeleted?: Prisma.IntFieldUpdateOperationsInput | number
commandResponses?: Prisma.IntFieldUpdateOperationsInput | number
timesTriggered?: Prisma.IntFieldUpdateOperationsInput | number
}
export type DailyStatsUncheckedUpdateInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
linksDeleted?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
commandResponses?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
timesTriggered?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
linksDeleted?: Prisma.IntFieldUpdateOperationsInput | number
commandResponses?: Prisma.IntFieldUpdateOperationsInput | number
timesTriggered?: Prisma.IntFieldUpdateOperationsInput | number
}
export type DailyStatsCreateManyInput = {
createdAt?: Date | string
updatedAt?: Date | string
linksDeleted?: bigint | number
commandResponses?: bigint | number
timesTriggered?: bigint | number
linksDeleted?: number
commandResponses?: number
timesTriggered?: number
}
export type DailyStatsUpdateManyMutationInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
linksDeleted?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
commandResponses?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
timesTriggered?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
linksDeleted?: Prisma.IntFieldUpdateOperationsInput | number
commandResponses?: Prisma.IntFieldUpdateOperationsInput | number
timesTriggered?: Prisma.IntFieldUpdateOperationsInput | number
}
export type DailyStatsUncheckedUpdateManyInput = {
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
linksDeleted?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
commandResponses?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
timesTriggered?: Prisma.BigIntFieldUpdateOperationsInput | bigint | number
linksDeleted?: Prisma.IntFieldUpdateOperationsInput | number
commandResponses?: Prisma.IntFieldUpdateOperationsInput | number
timesTriggered?: Prisma.IntFieldUpdateOperationsInput | number
}
export type DailyStatsCountOrderByAggregateInput = {
@@ -356,6 +357,14 @@ export type DailyStatsSumOrderByAggregateInput = {
timesTriggered?: Prisma.SortOrder
}
export type IntFieldUpdateOperationsInput = {
set?: number
increment?: number
decrement?: number
multiply?: number
divide?: number
}
export type DailyStatsSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
@@ -384,9 +393,9 @@ export type $DailyStatsPayload<ExtArgs extends runtime.Types.Extensions.Internal
scalars: runtime.Types.Extensions.GetPayloadResult<{
createdAt: Date
updatedAt: Date
linksDeleted: bigint
commandResponses: bigint
timesTriggered: bigint
linksDeleted: number
commandResponses: number
timesTriggered: number
}, ExtArgs["result"]["dailyStats"]>
composites: {}
}
@@ -781,9 +790,9 @@ export interface Prisma__DailyStatsClient<T, Null = never, ExtArgs extends runti
export interface DailyStatsFieldRefs {
readonly createdAt: Prisma.FieldRef<"DailyStats", 'DateTime'>
readonly updatedAt: Prisma.FieldRef<"DailyStats", 'DateTime'>
readonly linksDeleted: Prisma.FieldRef<"DailyStats", 'BigInt'>
readonly commandResponses: Prisma.FieldRef<"DailyStats", 'BigInt'>
readonly timesTriggered: Prisma.FieldRef<"DailyStats", 'BigInt'>
readonly linksDeleted: Prisma.FieldRef<"DailyStats", 'Int'>
readonly commandResponses: Prisma.FieldRef<"DailyStats", 'Int'>
readonly timesTriggered: Prisma.FieldRef<"DailyStats", 'Int'>
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,7 @@
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck
/*
* This file exports the `TotalStats` model and its related types.
File diff suppressed because it is too large Load Diff
+7 -23
View File
@@ -14,7 +14,7 @@ datasource db {
url = env("DATABASE_URL")
}
model Group {
model Groups {
telegramID Int @id @map("_id") @db.Int
name String
createdAt DateTime @default(now())
@@ -24,31 +24,15 @@ model Group {
model TotalStats {
createdAt DateTime @id @default(now()) @map("_id")
updatedAt DateTime @default(now()) @updatedAt
linksDeleted BigInt @default(0)
commandResponses BigInt @default(0)
timesTriggered BigInt @default(0)
linksDeleted BigInt @default(0) @db.Long
commandResponses BigInt @default(0) @db.Long
timesTriggered BigInt @default(0) @db.Long
}
model DailyStats {
createdAt DateTime @id @default(now()) @map("_id")
updatedAt DateTime @default(now()) @updatedAt
linksDeleted BigInt @default(0)
commandResponses BigInt @default(0)
timesTriggered BigInt @default(0)
}
model WeeklyStats {
createdAt DateTime @id @default(now()) @map("_id")
updatedAt DateTime @default(now()) @updatedAt
linksDeleted BigInt @default(0)
commandResponses BigInt @default(0)
timesTriggered BigInt @default(0)
}
model MonthlyStats {
createdAt DateTime @id @default(now()) @map("_id")
updatedAt DateTime @default(now()) @updatedAt()
linksDeleted BigInt @default(0)
commandResponses BigInt @default(0)
timesTriggered BigInt @default(0)
linksDeleted Int @default(0) @db.Int
commandResponses Int @default(0) @db.Int
timesTriggered Int @default(0) @db.Int
}