renamed a type + small improvements

This commit is contained in:
Daniel
2023-06-16 16:25:21 +03:30
parent 93558bb791
commit c1831b650d
18 changed files with 70 additions and 70 deletions
@@ -9,6 +9,9 @@ export default async function getCollection(userId: number) {
],
},
include: {
_count: {
select: { links: true },
},
members: {
include: {
user: {
@@ -1,9 +1,9 @@
import { prisma } from "@/lib/api/db";
import { CollectionIncludingMembers } from "@/types/global";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import { existsSync, mkdirSync } from "fs";
export default async function postCollection(
collection: CollectionIncludingMembers,
collection: CollectionIncludingMembersAndLinkCount,
userId: number
) {
if (!collection || collection.name.trim() === "")
@@ -50,6 +50,9 @@ export default async function postCollection(
},
},
include: {
_count: {
select: { links: true },
},
members: {
include: {
user: {
@@ -1,9 +1,9 @@
import { prisma } from "@/lib/api/db";
import { CollectionIncludingMembers } from "@/types/global";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import getPermission from "@/lib/api/getPermission";
export default async function updateCollection(
collection: CollectionIncludingMembers,
collection: CollectionIncludingMembersAndLinkCount,
userId: number
) {
if (!collection.id)
@@ -27,6 +27,7 @@ export default async function updateCollection(
where: {
id: collection.id,
},
data: {
name: collection.name,
description: collection.description,
@@ -42,6 +43,9 @@ export default async function updateCollection(
},
},
include: {
_count: {
select: { links: true },
},
members: {
include: {
user: {