mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Preparing for deployment
This commit is contained in:
parent
17ca8fcf59
commit
0a40b7c04c
@ -4,10 +4,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "prisma generate && next build && prisma migrate deploy",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"postinstall": "npx prisma generate"
|
"postinstall": "prisma generate"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.645.0",
|
"@aws-sdk/client-s3": "^3.645.0",
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
// datasource db {
|
||||||
|
// provider = "postgresql"
|
||||||
|
// url = env("DATABASE_URL")
|
||||||
|
// }
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("DATABASE_URL")
|
url = env("POSTGRES_PRISMA_URL")
|
||||||
|
directUrl = env("POSTGRES_URL_NON_POOLING")
|
||||||
}
|
}
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
|
@ -39,8 +39,6 @@ export default function CourseDetails({ processedEvent, paidCourse, lessons, dec
|
|||||||
const windowWidth = useWindowWidth();
|
const windowWidth = useWindowWidth();
|
||||||
const isMobileView = windowWidth <= 768;
|
const isMobileView = windowWidth <= 768;
|
||||||
|
|
||||||
const lnAddress = process.env.NEXT_PUBLIC_LIGHTNING_ADDRESS;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session) {
|
if (session) {
|
||||||
setUser(session.user);
|
setUser(session.user);
|
||||||
@ -86,7 +84,7 @@ export default function CourseDetails({ processedEvent, paidCourse, lessons, dec
|
|||||||
if (paidCourse && !decryptionPerformed) {
|
if (paidCourse && !decryptionPerformed) {
|
||||||
return (
|
return (
|
||||||
<CoursePaymentButton
|
<CoursePaymentButton
|
||||||
lnAddress={lnAddress}
|
lnAddress={author?.lnAddress}
|
||||||
amount={processedEvent.price}
|
amount={processedEvent.price}
|
||||||
onSuccess={handlePaymentSuccess}
|
onSuccess={handlePaymentSuccess}
|
||||||
onError={handlePaymentError}
|
onError={handlePaymentError}
|
||||||
|
@ -19,8 +19,6 @@ import appConfig from "@/config/appConfig";
|
|||||||
import useTrackCourse from '@/hooks/tracking/useTrackCourse';
|
import useTrackCourse from '@/hooks/tracking/useTrackCourse';
|
||||||
import { ProgressSpinner } from 'primereact/progressspinner';
|
import { ProgressSpinner } from 'primereact/progressspinner';
|
||||||
|
|
||||||
const lnAddress = process.env.NEXT_PUBLIC_LIGHTNING_ADDRESS;
|
|
||||||
|
|
||||||
export default function CourseDetailsNew({ processedEvent, paidCourse, lessons, decryptionPerformed, handlePaymentSuccess, handlePaymentError }) {
|
export default function CourseDetailsNew({ processedEvent, paidCourse, lessons, decryptionPerformed, handlePaymentSuccess, handlePaymentError }) {
|
||||||
const [zapAmount, setZapAmount] = useState(0);
|
const [zapAmount, setZapAmount] = useState(0);
|
||||||
const [author, setAuthor] = useState(null);
|
const [author, setAuthor] = useState(null);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import prisma from "../prisma";
|
import prisma from "../prisma";
|
||||||
import { webln } from "@getalby/sdk";
|
|
||||||
import { LightningAddress } from "@getalby/sdk";
|
|
||||||
|
|
||||||
const lnAddress = process.env.NEXT_PUBLIC_LIGHTNING_ADDRESS;
|
|
||||||
|
|
||||||
export const getAllUsers = async () => {
|
export const getAllUsers = async () => {
|
||||||
return await prisma.user.findMany({
|
return await prisma.user.findMany({
|
||||||
|
@ -12,7 +12,9 @@ import { updateUser } from "@/db/models/userModels";
|
|||||||
import { createRole } from "@/db/models/roleModels";
|
import { createRole } from "@/db/models/roleModels";
|
||||||
import appConfig from "@/config/appConfig";
|
import appConfig from "@/config/appConfig";
|
||||||
|
|
||||||
const BASE_URL = process.env.BASE_URL;
|
// todo update EMAIL_FROM to be a plebdevs email
|
||||||
|
|
||||||
|
const BACKEND_URL = process.env.BACKEND_URL;
|
||||||
|
|
||||||
const ndk = new NDK({
|
const ndk = new NDK({
|
||||||
explicitRelayUrls: appConfig.defaultRelayUrls,
|
explicitRelayUrls: appConfig.defaultRelayUrls,
|
||||||
@ -26,7 +28,7 @@ const authorize = async (pubkey) => {
|
|||||||
const profile = await user.fetchProfile();
|
const profile = await user.fetchProfile();
|
||||||
|
|
||||||
// Check if user exists, create if not
|
// Check if user exists, create if not
|
||||||
const response = await axios.get(`${BASE_URL}/api/users/${pubkey}`);
|
const response = await axios.get(`${BACKEND_URL}/api/users/${pubkey}`);
|
||||||
if (response.status === 200 && response.data) {
|
if (response.status === 200 && response.data) {
|
||||||
const fields = await findKind0Fields(profile);
|
const fields = await findKind0Fields(profile);
|
||||||
|
|
||||||
@ -34,7 +36,7 @@ const authorize = async (pubkey) => {
|
|||||||
const combinedUser = { ...fields, ...response.data };
|
const combinedUser = { ...fields, ...response.data };
|
||||||
|
|
||||||
// Update the user on the backend if necessary
|
// Update the user on the backend if necessary
|
||||||
// await axios.put(`${BASE_URL}/api/users/${combinedUser.id}`, combinedUser);
|
// await axios.put(`${BACKEND_URL}/api/users/${combinedUser.id}`, combinedUser);
|
||||||
|
|
||||||
return combinedUser;
|
return combinedUser;
|
||||||
} else if (response.status === 204) {
|
} else if (response.status === 204) {
|
||||||
@ -43,7 +45,7 @@ const authorize = async (pubkey) => {
|
|||||||
const fields = await findKind0Fields(profile);
|
const fields = await findKind0Fields(profile);
|
||||||
const payload = { pubkey, ...fields };
|
const payload = { pubkey, ...fields };
|
||||||
|
|
||||||
const createUserResponse = await axios.post(`${BASE_URL}/api/users`, payload);
|
const createUserResponse = await axios.post(`${BACKEND_URL}/api/users`, payload);
|
||||||
return createUserResponse.data;
|
return createUserResponse.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user