Release 202507031117
This commit is contained in:
@@ -275,7 +275,7 @@ CREATE OR REPLACE FUNCTION handle_suggestion_status_change()
|
|||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
service_name TEXT;
|
service_name TEXT;
|
||||||
service_visibility "ServiceVisibility";
|
service_visibility "serviceVisibility";
|
||||||
is_user_admin_or_moderator BOOLEAN;
|
is_user_admin_or_moderator BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Award karma for first approval
|
-- Award karma for first approval
|
||||||
@@ -283,7 +283,7 @@ BEGIN
|
|||||||
-- and ensure it wasn't already APPROVED.
|
-- and ensure it wasn't already APPROVED.
|
||||||
IF OLD.status IS DISTINCT FROM 'APPROVED' AND NEW.status = 'APPROVED' THEN
|
IF OLD.status IS DISTINCT FROM 'APPROVED' AND NEW.status = 'APPROVED' THEN
|
||||||
-- Fetch service details for the description
|
-- Fetch service details for the description
|
||||||
SELECT name, visibility INTO service_name, service_visibility FROM "Service" WHERE id = NEW."serviceId";
|
SELECT name, serviceVisibility INTO service_name, service_visibility FROM "Service" WHERE id = NEW."serviceId";
|
||||||
|
|
||||||
-- Only award karma if the service is public
|
-- Only award karma if the service is public
|
||||||
IF service_visibility = 'PUBLIC' THEN
|
IF service_visibility = 'PUBLIC' THEN
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import { makeSearchFiltersOptions } from '../../lib/searchFiltersOptions'
|
|||||||
import type { APIRoute } from 'astro'
|
import type { APIRoute } from 'astro'
|
||||||
|
|
||||||
export const GET: APIRoute = async ({ site }) => {
|
export const GET: APIRoute = async ({ site }) => {
|
||||||
if (!site) {
|
if (!site) return new Response('Site URL not configured', { status: 500 })
|
||||||
return new Response('Site URL not configured', { status: 500 })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
const searchUrls = await generateSEOSitemapUrls(site.href)
|
const searchUrls = await generateSEOSitemapUrls(site.href)
|
||||||
|
|
||||||
const result = `
|
const result = `
|
||||||
@@ -25,10 +24,13 @@ export const GET: APIRoute = async ({ site }) => {
|
|||||||
'Content-Type': 'application/xml',
|
'Content-Type': 'application/xml',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to generate SEO sitemap URLs:', error)
|
||||||
|
return new Response('Failed to generate SEO sitemap URLs', { status: 500 })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateSEOSitemapUrls(siteUrl: string) {
|
async function generateSEOSitemapUrls(siteUrl: string) {
|
||||||
try {
|
|
||||||
const [categories, attributes] = await Promise.all([
|
const [categories, attributes] = await Promise.all([
|
||||||
prisma.category.findMany({
|
prisma.category.findMany({
|
||||||
select: {
|
select: {
|
||||||
@@ -185,8 +187,4 @@ async function generateSEOSitemapUrls(siteUrl: string) {
|
|||||||
url.search = queryParams.toString()
|
url.search = queryParams.toString()
|
||||||
return url.href
|
return url.href
|
||||||
})
|
})
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to generate SEO sitemap URLs:', error)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user