mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
Fix enum issue.
This commit is contained in:
parent
ac5ec730d2
commit
ce02958bc2
@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
export namespace UmamiApi {
|
||||
enum EventType {
|
||||
export enum EventType {
|
||||
Pageview = 1,
|
||||
Event = 2,
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
import cache from 'lib/cache';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
@ -82,22 +82,16 @@ export async function updateUser(
|
||||
data: Prisma.UserUpdateInput,
|
||||
where: Prisma.UserWhereUniqueInput,
|
||||
): Promise<User> {
|
||||
return prisma.client.user
|
||||
.update({
|
||||
where,
|
||||
data,
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
createdAt: true,
|
||||
userRole: true,
|
||||
},
|
||||
})
|
||||
.then(user => {
|
||||
const { userRole, ...rest } = user;
|
||||
|
||||
return { ...rest, isAdmin: userRole.some(a => a.roleId === UmamiApi.SystemRole.Admin) };
|
||||
});
|
||||
return prisma.client.user.update({
|
||||
where,
|
||||
data,
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
createdAt: true,
|
||||
userRole: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteUser(
|
||||
|
@ -3,7 +3,7 @@ import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import cache from 'lib/cache';
|
||||
import { WebsiteMetric } from 'interface/api/models';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function getEventData(
|
||||
...args: [
|
||||
|
@ -3,7 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { WebsiteEventMetric } from 'interface/api/models';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function getEventMetrics(
|
||||
...args: [
|
||||
|
@ -4,7 +4,7 @@ import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import cache from 'lib/cache';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function saveEvent(args: {
|
||||
id: string;
|
||||
|
@ -3,7 +3,7 @@ import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import cache from 'lib/cache';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function getPageviewMetrics(
|
||||
...args: [
|
||||
|
@ -2,7 +2,7 @@ import cache from 'lib/cache';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import prisma from 'lib/prisma';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function getPageviewStats(
|
||||
...args: [
|
||||
|
@ -4,7 +4,7 @@ import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import cache from 'lib/cache';
|
||||
import { uuid } from 'lib/crypto';
|
||||
import { UmamiApi } from 'interface/enum';
|
||||
import { UmamiApi } from 'lib/enum';
|
||||
|
||||
export async function savePageView(args: {
|
||||
id: string;
|
||||
|
Loading…
Reference in New Issue
Block a user