Sergio Visinoni
Sergio Visinoni
WWasp-lang
Created by Sergio Visinoni on 10/14/2024 in #đŸ™‹questions
Jobs workers to consume from a queue
@kapa.ai if I go with the suggested approach, are there mechanisms in place to ensure that there won't be multiple jobs running in parallel, which would require me to implement a locking logic on the queue?
13 replies
WWasp-lang
Created by Sergio Visinoni on 10/14/2024 in #đŸ™‹questions
Jobs workers to consume from a queue
@kapa.ai would it be possible to spawn a job / worker that is always running, listening to events on a certain postgres table to be used as an event queue?
13 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
Absolutely @miho , conceptually it makes perfect sense to no include prisma into the frontend, it's just that enums are a bit of a special case in the sense that the boundaries between what's a type and what's a model is a bit more blurred. I'm happy with the current workaround, thanks for taking your time
41 replies
WWasp-lang
Created by Sergio Visinoni on 10/4/2024 in #đŸ™‹questions
Username and Email field in the User model
Thanks a lot for the clarification @martinsos !
8 replies
WWasp-lang
Created by fustuk. on 9/2/2024 in #đŸ™‹questions
SendGrid 403 Error
FWIW, I've been hit by the same issue. Having a question here is a good fallback while waiting for the error message to become more self-explanatory!
27 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@miho I can confirm that it works properly if I just import the type, and then re-declare the enum values in the code. Not the most elegant solution, but it works for now. At least I'm not blocked any longer. Still, I'd be curious to know if there is a way to properly reference enum values on the client side
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
Another way could be to only import enums as types, rather than values, but then I'll have to again re-define all the possible values in the code
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
Sure @miho . Keep in mind I have a backend background and only started playing with React a couple of weeks ago when I discovered Wasp (loving it). I'm pretty sure I'm doing something wrong, though I was surprised to discover the issue only when I deployed, as in my local environment, everything is working as expected. One of those cases of works on my laptop I guess. So, I have defined this enum in Prisma:
enum OneToOneMeetingStatus {
SCHEDULED
COMPLETED
POSTPONED
CANCELLED
}
enum OneToOneMeetingStatus {
SCHEDULED
COMPLETED
POSTPONED
CANCELLED
}
I then import it my TS code like this import { OneToOneMeetingStatus } from '@prisma/client'; Then, I use the Models this way:
const getStatusColor = (status: OneToOneMeetingStatus) => {
switch (status) {
case 'SCHEDULED':
return 'bg-blue-200 text-blue-800 dark:bg-blue-700 dark:text-blue-100';
case 'COMPLETED':
return 'bg-green-200 text-green-800 dark:bg-green-700 dark:text-green-100';
case 'CANCELLED':
return 'bg-red-200 text-red-800 dark:bg-red-700 dark:text-red-100';
default:
return 'bg-gray-200 text-gray-800 dark:bg-gray-600 dark:text-gray-100';
}
};

const formatStatus = (status: OneToOneMeetingStatus | OneToOneMeetingOverallFeeling) => {
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
};
const getStatusColor = (status: OneToOneMeetingStatus) => {
switch (status) {
case 'SCHEDULED':
return 'bg-blue-200 text-blue-800 dark:bg-blue-700 dark:text-blue-100';
case 'COMPLETED':
return 'bg-green-200 text-green-800 dark:bg-green-700 dark:text-green-100';
case 'CANCELLED':
return 'bg-red-200 text-red-800 dark:bg-red-700 dark:text-red-100';
default:
return 'bg-gray-200 text-gray-800 dark:bg-gray-600 dark:text-gray-100';
}
};

const formatStatus = (status: OneToOneMeetingStatus | OneToOneMeetingOverallFeeling) => {
return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase();
};
And here I'm blocked. If there is no easy way, I might use strings instead of enums for now, but then I'll introduce the risk of using invalid values by mistake. Thanks in advance!
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@kapa.ai do you know if it's on purpose that prisma models are not available to the client?
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@kapa.ai see the previous conversation. I found a workaround that seems to work locally, but that includes manually installing prisma in the web-app directory prior to running the client, and I'm not sure that's the ideal approach. Furthermore, it requires me to stop using wasp deploy fly deploy as I'll need to fiddle with the content of the build directory before building the Docker container to be shipped on fly.
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@miho I'm facing a follow-up issue with this, and I don't know if it's a wasp bug since it only manifests itself when I deploy the software in a live environment. Basically, I've been using Enums in my code following the approach you suggested, and all works well. But now my client once deployed doesn't load and fails with the following JS error
Uncaught TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../".
Uncaught TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../".
I've been looking online and tried following the suggestions found here https://github.com/sveltejs/kit/issues/4444 to use an alias in vite.config.ts, but it turns out prisma is not even installed as a dependency for the client, which kind of makes sense. Does this mean I'm stuck with not being able to use enums models in the client code or is there a better way to work around the issue with Wasp? @kapa.ai any idea?
41 replies
WWasp-lang
Created by Sergio Visinoni on 10/2/2024 in #đŸ™‹questions
is there a way to customize the autogenerated fly.toml files for deploying on fly?
@kapa.ai is it normal that after running a clean wasp build there is a Dockcerfile in .wasp/build but not one in .wasp/build-web-app? Deploying the client on Fly is failing because of that
11 replies
WWasp-lang
Created by Hastur on 9/30/2024 in #đŸ™‹questions
What is the best way to update from 0.14.0 to 0.14.2?
Thanks @miho !
8 replies
WWasp-lang
Created by Hastur on 9/30/2024 in #đŸ™‹questions
What is the best way to update from 0.14.0 to 0.14.2?
Follow up question here: is it enough to change the version string in my main.wasp file or do I need to go through more steps when upgrading from 0.14.0 to 0.14.2?
8 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
That worked, thanks a lot!
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
Thanks @miho , I'll try importing directly from '@prisma/client' then!
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@kapa.ai enums seem to be supported since this https://github.com/wasp-lang/wasp/pull/2035
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
@kapa.ai any chance now?
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/19/2024 in #đŸ™‹questions
Referencing entities via enums
OK
41 replies
WWasp-lang
Created by Sergio Visinoni on 9/17/2024 in #đŸ™‹questions
Best practices for splitting queries and operations
Thanks, solved!
9 replies