wailroth
wailroth
Explore posts from servers
WWasp-lang
Created by wailroth on 8/10/2024 in #🙋questions
Unable to create opensaas project
Hi! I don't know why i'm getting this error, trying to create a new project:
wasp new -t saas
Enter the project name (e.g. my-project) ▸ saas-test

🐝 --- Creating your project from the "saas" template... --------------------------



❌ --- [Error] Project creation failed: -------------------------------------------

HttpExceptionRequest Request {
host = "github.com"
port = 443
secure = True
requestHeaders = [("Connection","close")]
path = "/wasp-lang/open-saas/archive/wasp-v0.14-template.tar.gz"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(InternalException (HostCannotConnect "github.com" [Network.Socket.connect: <socket: 59>: invalid argument (Bad file descriptor)]))
wasp new -t saas
Enter the project name (e.g. my-project) ▸ saas-test

🐝 --- Creating your project from the "saas" template... --------------------------



❌ --- [Error] Project creation failed: -------------------------------------------

HttpExceptionRequest Request {
host = "github.com"
port = 443
secure = True
requestHeaders = [("Connection","close")]
path = "/wasp-lang/open-saas/archive/wasp-v0.14-template.tar.gz"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(InternalException (HostCannotConnect "github.com" [Network.Socket.connect: <socket: 59>: invalid argument (Bad file descriptor)]))
11 replies
CC#
Created by wailroth on 6/8/2024 in #help
Refresh a card without refreshing the whole board
Hi, For my studies we have to make a small game in MAUI; Si basically have this Matrix2D
public void RefreshMatrix(Card card)
{
var index = FlatMatrix2d.ToList().FindIndex(x => x.Value == card.Value);
_matrix = Game.GetCardBoardClone();
FlatMatrix2d.ElementAt(index).IsVisible = card.IsVisible;
OnPropertyChanged(nameof(FlatMatrix2d));
}

public IEnumerable<Card> FlatMatrix2d
{
get => _flatMatrix2d;
set
{
_flatMatrix2d = value;
OnPropertyChanged();
}
}

public IEnumerable<Card> GetFlatMatrix()
{
List<Card> flatMatrix = new();

if (_matrix == null) return flatMatrix;
for (int numRow = 0; numRow < NbRows; numRow++)
{
for (int numCol = 0; numCol < NbColumns; numCol++)
{
flatMatrix.Add(_matrix[numRow, numCol]);
}
}

return flatMatrix;
}
public void RefreshMatrix(Card card)
{
var index = FlatMatrix2d.ToList().FindIndex(x => x.Value == card.Value);
_matrix = Game.GetCardBoardClone();
FlatMatrix2d.ElementAt(index).IsVisible = card.IsVisible;
OnPropertyChanged(nameof(FlatMatrix2d));
}

public IEnumerable<Card> FlatMatrix2d
{
get => _flatMatrix2d;
set
{
_flatMatrix2d = value;
OnPropertyChanged();
}
}

public IEnumerable<Card> GetFlatMatrix()
{
List<Card> flatMatrix = new();

if (_matrix == null) return flatMatrix;
for (int numRow = 0; numRow < NbRows; numRow++)
{
for (int numCol = 0; numCol < NbColumns; numCol++)
{
flatMatrix.Add(_matrix[numRow, numCol]);
}
}

return flatMatrix;
}
then my board
public void Card_Clicked(object sender, EventArgs e)
{
_effectContainer.PlaySound();
if (!_shouldPlayNextTurn)
{
_shouldPlayNextTurn = true;
return;
}

var button = (ImageButton)sender;
var card = (Card)button.BindingContext;
_gameManager.PlayTurn(card.X, card.Y);

//Quand la game est fini si duo faire pour la persistance :

//SaveManager saveManager = new SaveManager();
//GameSave parameter = new GameSave("NameWinner", "NameLooser", "winnerScore", "looserScore", "difficulty");
//saveManager.UpdateGameHistory(parameter);
}


private void OnCardTurned(Card card)
{
Matrix.RefreshMatrix(card);
OnPropertyChanged(nameof(Matrix.FlatMatrix2d));
}


public void Card_Clicked(object sender, EventArgs e)
{
_effectContainer.PlaySound();
if (!_shouldPlayNextTurn)
{
_shouldPlayNextTurn = true;
return;
}

var button = (ImageButton)sender;
var card = (Card)button.BindingContext;
_gameManager.PlayTurn(card.X, card.Y);

//Quand la game est fini si duo faire pour la persistance :

//SaveManager saveManager = new SaveManager();
//GameSave parameter = new GameSave("NameWinner", "NameLooser", "winnerScore", "looserScore", "difficulty");
//saveManager.UpdateGameHistory(parameter);
}


private void OnCardTurned(Card card)
{
Matrix.RefreshMatrix(card);
OnPropertyChanged(nameof(Matrix.FlatMatrix2d));
}


The isssue is: I can't refresh just 1 card to make it visible
4 replies
TTCTheo's Typesafe Cult
Created by wailroth on 5/22/2024 in #questions
Advices for an electron app
Hello guys, I have some conceptions issues with electron, Sometimes, my app will be on non connected computer, sometimes, will be connected. My issue is: for non connected, I have to store the data somewhere, I decided on litesql But, for the connnected computer, I have 2 choices: include all sql calls to the app, then setup a sql server somewhere for my customers OR develop an API that will handle all of that. Considering, that for now, it's like 1 customer per computer per enterprise, sometimes 2 so it have to be synchronised For now, I think that a client connection could work, but if I want to scale up, i'll need to develop and API.
7 replies
CC#
Created by wailroth on 3/21/2024 in #help
Maui .NET 8.0 On macOS
No description
2 replies
DTDrizzle Team
Created by wailroth on 10/22/2023 in #help
Schema to type
Hey guys, how do you make a schema item as a static type ? for example, this thing:
export const orderItems = pgTable("orderItem", {
product_id: serial("product_id").notNull(),
order_id: serial("order_id").notNull(),
quantity: integer("quantity")

},
(orderItems) => ({
compoundKey: primaryKey(orderItems.product_id, orderItems.order_id),
}
))
export const orderItems = pgTable("orderItem", {
product_id: serial("product_id").notNull(),
order_id: serial("order_id").notNull(),
quantity: integer("quantity")

},
(orderItems) => ({
compoundKey: primaryKey(orderItems.product_id, orderItems.order_id),
}
))
as
{
productId: number,
order_id: number,
quantity: number
}
{
productId: number,
order_id: number,
quantity: number
}
24 replies
DTDrizzle Team
Created by wailroth on 10/12/2023 in #help
Add even when object is null?
Hi guys, I have some issues with my schema:
export const userItems = pgTable("userItem", {
product_id: serial("product_id").notNull(),
user_id: text("user_id").notNull(),
quantity: integer("quantity")
},
(userItems) => ({
compoundKey: primaryKey(userItems.product_id, userItems.user_id),
}
)
)

export const userItemsRelations = relations(userItems, ({one}) => ({
product: one(products, {
fields: [userItems.product_id],
references: [products.id]
}),

user: one(users, {
fields: [userItems.user_id],
references: [users.id]
}),
}))
export const userItems = pgTable("userItem", {
product_id: serial("product_id").notNull(),
user_id: text("user_id").notNull(),
quantity: integer("quantity")
},
(userItems) => ({
compoundKey: primaryKey(userItems.product_id, userItems.user_id),
}
)
)

export const userItemsRelations = relations(userItems, ({one}) => ({
product: one(products, {
fields: [userItems.product_id],
references: [products.id]
}),

user: one(users, {
fields: [userItems.user_id],
references: [users.id]
}),
}))
You can see a small part of my schema. In fact, I can add a user item even when the product_id, that refers to my product id, doesn't exist. How can I tackle this issue ? I should check before the insert in my request? Thanks
7 replies
TTCTheo's Typesafe Cult
Created by wailroth on 10/4/2023 in #questions
NextAuth custom properties for session
Hi guys, there is my nextauth config using drizzle
import {DrizzleAdapter} from "@auth/drizzle-adapter";
import {
DefaultSession,
getServerSession,
type NextAuthOptions,
} from "next-auth";
import DiscordProvider from "next-auth/providers/discord";

import {env} from "@/env.mjs";
import {db} from "@/server/db";
import {pgTable, sessions} from "@/server/db/schema";

/**
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
*
* @see https://next-auth.js.org/configuration/options
*/

declare module "next-auth" {
interface Session extends DefaultSession {
user: {
id: string;
isStaff: boolean
} & DefaultSession["user"];
}

interface User {
// ...other properties
isStaff: boolean
}
}

export const authOptions: NextAuthOptions = {
callbacks: {
session: ({ session, user }) => ({
...session,
user: {
...session.user,
id: user.id,
isStaff: user.isStaff
},
}),
},
pages: {
//signOut: '/api/auth/signout',
newUser: "/api/auth/register"

},
adapter: DrizzleAdapter(db, pgTable),
providers: [
DiscordProvider({
clientId: env.DISCORD_CLIENT_ID,
clientSecret: env.DISCORD_CLIENT_SECRET,
}),

*/
export const getServerAuthSession = () => getServerSession(authOptions);
import {DrizzleAdapter} from "@auth/drizzle-adapter";
import {
DefaultSession,
getServerSession,
type NextAuthOptions,
} from "next-auth";
import DiscordProvider from "next-auth/providers/discord";

import {env} from "@/env.mjs";
import {db} from "@/server/db";
import {pgTable, sessions} from "@/server/db/schema";

/**
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
*
* @see https://next-auth.js.org/configuration/options
*/

declare module "next-auth" {
interface Session extends DefaultSession {
user: {
id: string;
isStaff: boolean
} & DefaultSession["user"];
}

interface User {
// ...other properties
isStaff: boolean
}
}

export const authOptions: NextAuthOptions = {
callbacks: {
session: ({ session, user }) => ({
...session,
user: {
...session.user,
id: user.id,
isStaff: user.isStaff
},
}),
},
pages: {
//signOut: '/api/auth/signout',
newUser: "/api/auth/register"

},
adapter: DrizzleAdapter(db, pgTable),
providers: [
DiscordProvider({
clientId: env.DISCORD_CLIENT_ID,
clientSecret: env.DISCORD_CLIENT_SECRET,
}),

*/
export const getServerAuthSession = () => getServerSession(authOptions);
as you can see, I have normally custom properties like isStaff. But, when I log my session, isStaff or any other propertie is always null
3 replies
TTCTheo's Typesafe Cult
Created by wailroth on 5/2/2023 in #questions
Edit default sign in form
52 replies