Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/app/api/sponsor-dashboard/listing/check-slug/route.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import { headers } from 'next/headers';
import { type NextRequest, NextResponse } from 'next/server';

import logger from '@/lib/logger';
import { safeStringify } from '@/utils/safeStringify';

import { getUserSession } from '@/features/auth/utils/getUserSession';
import {
checkSlug,
generateUniqueSlug,
} from '@/features/listing-builder/utils/getValidSlug';

export async function GET(request: NextRequest) {
const session = await getUserSession(await headers());
if (session.status !== 200 || !session.data) {
return NextResponse.json(
{ error: session.error || 'Unauthorized' },
{ status: session.status || 401 },
);
}

const { searchParams } = new URL(request.url);
const slug = searchParams.get('slug');
const check = searchParams.get('check');
Expand Down
10 changes: 10 additions & 0 deletions src/app/api/sponsor-dashboard/listing/email-estimate/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { headers } from 'next/headers';
import { NextResponse } from 'next/server';
import { z } from 'zod';

import { skillsArraySchema } from '@/interface/skills';

import { getUserSession } from '@/features/auth/utils/getUserSession';
import { getEmailEstimate } from '@/features/listing-builder/components/Form/Boost/server-queries';

const BodySchema = z.object({
Expand All @@ -11,6 +13,14 @@ const BodySchema = z.object({
});

export async function POST(request: Request) {
const session = await getUserSession(await headers());
if (session.status !== 200 || !session.data) {
return NextResponse.json(
{ error: session.error || 'Unauthorized' },
{ status: session.status || 401 },
);
}

try {
const json = await request.json();
const { skills, region } = BodySchema.parse(json);
Expand Down
10 changes: 10 additions & 0 deletions src/app/api/sponsor-dashboard/listing/featured-posts/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { headers } from 'next/headers';
import { NextResponse } from 'next/server';

import { prisma } from '@/prisma';

import { getUserSession } from '@/features/auth/utils/getUserSession';
import { buildFeaturedAvailabilityWhere } from '@/features/listing-builder/utils/featured-availability';

export async function POST() {
const session = await getUserSession(await headers());
if (session.status !== 200 || !session.data) {
return NextResponse.json(
{ error: session.error || 'Unauthorized' },
{ status: session.status || 401 },
);
}

try {
const count = await prisma.bounties.count({
where: buildFeaturedAvailabilityWhere(),
Expand Down