Sven
Explore posts from serversWWasp-lang
•Created by Sven on 11/14/2024 in #đŸ™‹questions
Do i need to set client env vars every deploy?
when i deploy an update to fly do i need to set the client env vars again? every deploy
15 replies
PPrisma
•Created by Sven on 11/11/2024 in #help-and-questions
Help Needed with sorting/filtering data over Timeframe Based on Aggregated results
I'm working on a feature that involves querying daily event data and aggregating metrics over a specified timeframe (e.g., last 30 days or 90 days) for each event. Based on these aggregates, I need to filter and sort the events according to certain thresholds, such as total revenue or average price within the selected timeframe. Here’s a more detailed breakdown of my issue:
Data Structure:
Events table
: Stores information about each event, like its name and category.
EventData table
: Contains daily metrics for each event, including:
totalRevenue
: Total revenue generated by the event on a given day.
totalTicketsSold
: Total tickets sold on that day.
avgTicketPrice
: Average ticket price for that day.
eventDate
: The date of the event metrics.
The Events table has a relation to EventData
, where EventData
holds the daily details.
Query for all events within a given timeframe (e.g., last 30 or 90 days).
For each event, I need to aggregate the totalRevenue
, totalTicketsSold
, and avgTicketPrice
over the timeframe.
Apply filters on these aggregated values. For example:
Only retrieve events where the sum of totalRevenue
in the timeframe is between a specified minimum and maximum.
Similarly, apply filters for totalTicketsSold
and avgTicketPrice
(where avgticketprice is average price over that timeframe) based on specified thresholds.
Finally, sort the results based on one of these aggregate fields (e.g., sort by totalRevenue
in descending order).
Challanges im facing
Filtering on Aggregated Data: I need to filter events based on the sum or average of fields in EventData over the specified timeframe. For example, filtering events with a total revenue between 1000 and 5000 within the last 30 days.
Sorting: I want to sort the filtered results based on these aggregated values (e.g., total revenue or average ticket price).5 replies
WWasp-lang
•Created by Sven on 11/10/2024 in #đŸ™‹questions
Large database results in long data loading on frontend
What is a good way to sort and or filter data from a database table that is pretty large? Right now it takes a lot of time. When a user goes to the page that will show this data paginated it queries the database but the method i use now takes pretty long. Is there any efficient sort/filter algoritm i should use with postgres in order to reduce this time?
44 replies
WWasp-lang
•Created by Sven on 11/7/2024 in #đŸ™‹questions
Good way of adding a search to a prisma table
What is the best practise of making a query that searches a string on a database table. For example i have a field name and when a user searches that on the frontend i want a query to search this name in a table under field name.
What are best practises
7 replies
WWasp-lang
•Created by Sven on 11/2/2024 in #đŸ™‹questions
Context.user is null
{
[ Server ] user: null,
[ Server ] entities: {
.....
[ Server ] }
My context.user is null. HOw come this?
10 replies
WWasp-lang
•Created by Sven on 11/1/2024 in #đŸ™‹questions
I want to return a 401 status on an action when a certain error occurs
Hi kapa, i want to return a response of 401 when a certain action fails. In my case my action fetches some information from an external API but when this fails with a 401 status i want to also return a 401 status to the client.
Right now i do the following above but it throws the error but does still return a 200 to the client.
13 replies
WWasp-lang
•Created by Sven on 10/29/2024 in #đŸ™‹questions
How can i set a client side env var for production on fly
How can i set a client side env var for production on fly? I already deployed so i need to set it .
12 replies
WWasp-lang
•Created by Sven on 10/28/2024 in #đŸ™‹questions
304 error on auth/me after signing up
Kapa when i signed up and try to access a page for which authRequired is set to True. I can't access page and auth/me returns a 304 status.
10 replies
WWasp-lang
•Created by Sven on 10/27/2024 in #đŸ™‹questions
Production payment doesn't give user subscription
71 replies
WWasp-lang
•Created by Sven on 10/21/2024 in #đŸ™‹questions
where can i edit login and signup pages?
kapa where can i edit login and signup page? i want to edit the button colors and main texts
12 replies
WWasp-lang
•Created by Sven on 10/20/2024 in #đŸ™‹questions
failed to send email production app
When i try to sign up in my opensaas app it says "check email" but the server logs say:
```
POST /auth/email/signup 200 286.658 ms - 16
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] Failed to send email ResponseError: Forbidden
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] at /app/node_modules/@sendgrid/client/src/classes/client.js:146:29
2024-10-20T13:53:21.731 app[148e2444f9357] ams [info] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] code: 403,
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] response: {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] headers: {
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] server: 'nginx',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] date: 'Sun, 20 Oct 2024 13:53:21 GMT',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'content-type': 'application/json',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'content-length': '281',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] connection: 'close',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-origin': 'https://sendgrid.api-docs.io',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-methods': 'POST',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'access-control-max-age': '600',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html',
2024-10-20T13:53:21.731 app[148e2444f93578] ams [info] 'strict-transport-security': 'max-age=600; includeSubDomains'
18 replies
WWasp-lang
•Created by Sven on 10/19/2024 in #đŸ™‹questions
How do i properly deploy?
I am really stuck at the moment on how to deploy. In the docs there are alot of different pages that say alot. I am not sure what and how to pass through the environment variables i set....
For example the DATABASE_URL i can only set that after i deployed right? also WASP_WEB_CLIENT_URL, this is also known after i deployed right and WASP_SERVER_URL?
My main question is what env vars do I need to set before running any command and what after? And what environment variables do I need to set myself with that
secrets set
or --server-secret
?59 replies
WWasp-lang
•Created by Sven on 10/19/2024 in #đŸ™‹questions
Update / maintain production deployment
Lets say i deploy to fly my V1 of my app. How would i then maintain it and for example update it without having users loose data.
Let say i add a new page and some new actions locally. How can i push these to fly?
69 replies
WWasp-lang
•Created by Sven on 10/17/2024 in #đŸ™‹questions
I dont get the signup mail locally
I dont see the log for the signup mail in my local terminal, why is that? I did something with mailgun recently but I am not sure what.
6 replies
WWasp-lang
•Created by Sven on 10/15/2024 in #đŸ™‹questions
how do I show the users email on my frontend.
Hi kapa how can i show the users email on my frontend. Also for my opensaas project how can i extend the register field to have more things related to b2b.
18 replies
WWasp-lang
•Created by Sven on 10/14/2024 in #đŸ™‹questions
how does opensaas handle user data? According to the law!
I want to know how the opensaas template handles user data? Is it according to any law or guidline? I mean specifically the user entity.
Myself i made a different table with extra user information and encoded it i think 264bits.
7 replies
WWasp-lang
•Created by Sven on 10/13/2024 in #đŸ™‹questions
How could i run a query funciton on button click
I have the following code^. right now the getFilteredProducts query is ran everytime the page relaods or something happens. I only want it to be ran once when the button is clicked.
11 replies
WWasp-lang
•Created by Sven on 10/13/2024 in #đŸ™‹questions
Could I execute an action or multiple once per day on the server side?
Could I execute an action or multiple once per day on the server side for each user. It loads data from an api for that specific user, i want to know if I can make it such that this is done every day for each user.
9 replies
WWasp-lang
•Created by Sven on 10/7/2024 in #đŸ™‹questions
what is in essence the difference between a query and action
I have both queries and actions. I dont really understand the difference. Sometimes an action of mine checks if something exists in database and if it does it returns the already existing value and otherwhise it calculates it and appends it.
Is this proper?
7 replies
WWasp-lang
•Created by Sven on 10/4/2024 in #đŸ™‹questions
What environment vars need to be set in order to deploy for production
Hi what environment variables need to be set in order to deploy for production? e.g:
plausible? sendgrid? google analytics?
12 replies