OrBlatt
WWasp-lang
•Created by OrBlatt on 7/6/2024 in #🙋questions
Migrate db in Production fly.io
Anyone experienced data loss after entity schema update or know how to prevent it? 🙏
7 replies
WWasp-lang
•Created by OrBlatt on 7/2/2024 in #🙋questions
Derive username from userId
In github I see
https://github.com/wasp-lang/wasp/blob/f0bbdd37d91aa2480ae3df06c4147d0eae432449/waspc/data/Generator/templates/sdk/wasp/auth/session.ts#L55
async function getAuthUserData(userId: {= userEntityUpper =}['id']): Promise<AuthUserData> {
const user = await prisma.{= userEntityLower =}
.findUnique({
where: { id: userId },
include: {
{= authFieldOnUserEntityName =}: {
include: {
{= identitiesFieldOnAuthEntityName =}: true
}
}
}
})
Can I use this to get the username of a user given a userId?
@kapa.ai
21 replies
WWasp-lang
•Created by OrBlatt on 7/2/2024 in #🙋questions
Derive username from userId
I don't understand the options. @miho @kapa.ai
Here's what i have:
main.wasp
query getUserById {
fn: import { getUserById } from "@src/queries",
entities: [User],
}
server side:
queries.ts
export const getUserById: GetUserById<{ userId: number }, User> = async (args, context) => {
return context.entities.User.findMany({
where: {
id: args.userId
},
include: {
auth: true,
identities: true
}
})
}
client side:
import { getUserById, useQuery } from 'wasp/client/operations'
const { data: ownerUsername, error } = useQuery(getUserById, { id: ownerId })
Why isn't it working?
21 replies
WWasp-lang
•Created by OrBlatt on 7/2/2024 in #🙋questions
Derive username from userId
how can i create a query to fetch the user object from the databased using the userId?
@kapa.ai
21 replies
WWasp-lang
•Created by OrBlatt on 6/21/2024 in #🙋questions
Scheduling email sending with Pg-boss
Thank you Martin. I agree, option 1 or 2 are what I want. 🙏🙏🙏
20 replies
WWasp-lang
•Created by OrBlatt on 6/21/2024 in #🙋questions
Scheduling email sending with Pg-boss
To be able to send email digest only to the user who registered the search profile, should I add the User entitity to the job declaration like this?
job emailDigest {
executor: PgBoss,
perform: {
fn: import { sendEmailDigest } from "@ext/workers/emailSender"
},
schedule: {
cron: "0 0 * * *", // This should be dynamic based on user preference
args: {=json { "minPrice": 100, "maxPrice": 500 } json=} // This should be dynamic based on user's search profile
},
entities: [Task, User]
}
@kapa.ai
20 replies
WWasp-lang
•Created by OrBlatt on 6/21/2024 in #🙋questions
Scheduling email sending with Pg-boss
I want to send the email only to the user who registered the search profile. How can I enforce that?
@kapa.ai
20 replies
WWasp-lang
•Created by OrBlatt on 6/21/2024 in #🙋questions
Scheduling email sending with Pg-boss
How should i inject the cronInterval and args?
job emailDigest {
executor: PgBoss,
perform: {
fn: import { sendEmailDigest } from "@ext/workers/emailSender"
},
schedule: {
cron: cronInterval, // This should be dynamic based on user preference
args: {=json args json=} // This should be dynamic based on user's search profile
},
entities: [Task]
}
@kapa.ai
20 replies
WWasp-lang
•Created by OrBlatt on 6/13/2024 in #🙋questions
User `postgresWaspDevUser` was denied access on the database
I added the following line to pg_hba.conf, restarted the database via docker and it worked
host all all 192.168.65.1/32 trust
10 replies
WWasp-lang
•Created by OrBlatt on 6/13/2024 in #🙋questions
User `postgresWaspDevUser` was denied access on the database
By looking at pg_hba.conf i see this
TYPE DATABASE USER ADDRESS METHOD
"local" is for Unix domain socket connections only
local all all trust
IPv4 local connections:
host all all 127.0.0.1/32 trust
IPv6 local connections:
host all all ::1/128 trust
Allow replication connections from localhost, by a user with the
replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
How can i add the interal IP address the wasp client was using (this time 192.168.65.1)?
@kapa.ai
10 replies
WWasp-lang
•Created by OrBlatt on 6/4/2024 in #🙋questions
missing an opposite relation field
This is perfect, thank you
6 replies
WWasp-lang
•Created by OrBlatt on 6/4/2024 in #🙋questions
Timestamp with time zone attribute in PostgreSQL Database
If I use DateTime attribute, will it be migrated from DateTime to Timestamp with time zone when I move from SQLite to PostgreSQL? I'm asking because PostgreSQL is mandatory for deployment.
6 replies