
- Created query to find stations by tag - UI - Created pages to list station gallery for channels and tags - Created <StationsGallery> component
17 lines
475 B
TypeScript
17 lines
475 B
TypeScript
import { prisma } from "~/db.server";
|
|
import type { PrismaTxClient } from "~/models/station.server";
|
|
import { slugify } from "~/utils";
|
|
|
|
export function findTagBySlug(slug: string) {
|
|
return prisma.tag.findUnique({ where: { slug } });
|
|
}
|
|
|
|
export function upsertTagOnName(tag: string, p: PrismaTxClient = prisma) {
|
|
const slug = slugify(tag);
|
|
return p.tag.upsert({
|
|
where: { name: tag },
|
|
create: { name: tag, slug },
|
|
update: { slug }
|
|
});
|
|
}
|