refactor: some renaming and corrections

This commit is contained in:
Riccardo
2023-12-19 19:21:45 +01:00
parent c639f55067
commit 146ea54d71
18 changed files with 169 additions and 7545 deletions

View File

@@ -19,9 +19,16 @@ export async function GET(request: Request) {
where: {
confirmed: true,
deleted: false,
lastMail: {
lt: new Date(Date.now() - 1000 * 60 * 60 * 24 + 1000 * 10 * 60) // 24h - 10m
}
OR: [
{
lastMail: {
lt: new Date(Date.now() - 1000 * 60 * 60 * 24 + 1000 * 10 * 60) // 24h - 10m
}
},
{
lastMail: null
}
]
},
select: {
id: true,
@@ -38,7 +45,7 @@ export async function GET(request: Request) {
const news = await prisma.news.findMany({
where: {
createdAt: {
gt: new Date(Date.now() - 1000 * 60 * 60)
gt: new Date(Date.now() - 1000 * 60 * 60 * 24)
}
}
});

View File

@@ -6,10 +6,15 @@ export async function GET() {
orderBy: {
createdAt: 'desc'
},
take: 100
take: 50,
select: {
id: true,
title: true,
by: true
}
});
if (news && news.length === 100) {
if (news) {
return ApiResponse(200, JSON.stringify(news));
}

View File

@@ -2,7 +2,7 @@
import { useRouter, useSearchParams } from 'next/navigation';
import { useEffect, useState } from 'react';
import { z } from 'zod';
import { CustomCard } from '../../components/custom/card';
import { Card } from '../../components/custom/card';
import { ResponseSchema } from '../../utils/schemas';
export default function Confirmation() {
@@ -55,7 +55,7 @@ export default function Confirmation() {
}
return (
<CustomCard
<Card
style='text-center'
title={loading ? 'Verifying' : 'Confirmed!'}
content={render()}

View File

@@ -3,7 +3,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { useEffect, useRef, useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { CustomCard } from '../components/custom/card';
import { Card } from '../components/custom/card';
import ErrorMessage from '../components/custom/error';
import { Button } from '../components/ui/button';
import {
@@ -108,7 +108,7 @@ export default function Home() {
}
return (
<CustomCard
<Card
style='text-center'
title='Hackernews + newsletter'
description='Top stories from Hackernews. Once a day. Every day.'

View File

@@ -1,5 +1,5 @@
'use client';
import { CustomCard } from '../../components/custom/card';
import { Card } from '../../components/custom/card';
export default function Privacy() {
const body = (
@@ -25,7 +25,6 @@ export default function Privacy() {
</p>
<br />
<h2 className='styledH2'>Interpretation and Definitions</h2>
<br />
<h3 className='styledH3'>Interpretation</h3>
<p>
The words of which the initial letter is capitalized have meanings
@@ -116,9 +115,7 @@ export default function Privacy() {
</ul>
<br />
<h2 className='styledH2'>Collecting and Using Your Personal Data</h2>
<br />
<h3 className='styledH3'>Types of Data Collected</h3>
<br />
<h4 className='styledH4'>Personal Data</h4>
<p>
While using Our Service, We may ask You to provide Us with certain
@@ -432,7 +429,7 @@ export default function Privacy() {
);
return (
<CustomCard
<Card
title='Privacy Policy'
description='Last updated: December 03, 2023'
content={body}

View File

@@ -3,7 +3,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { useEffect, useRef, useState } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { CustomCard } from '../../components/custom/card';
import { Card } from '../../components/custom/card';
import ErrorMessage from '../../components/custom/error';
import { Button } from '../../components/ui/button';
import {
@@ -108,7 +108,7 @@ export default function Unsubscribe() {
}
return (
<CustomCard
<Card
style='text-center'
title='Unsubscribe'
description='You sure you want to leave? :('