Skip to content

Commit

Permalink
Fix pr #392: Fix issue #391: Homes
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Feb 21, 2025
1 parent 90dcf85 commit c4ba4c7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,10 @@ export const userDataRelations = relations(userData, ({ one, many }) => ({
fields: [userData.userId],
references: [userNindo.userId],
}),
home: one(userHome, {
fields: [userData.userId],
references: [userHome.userId],
}),
userQuests: many(questHistory),
conversations: many(user2conversation),
items: many(userItem),
Expand Down
11 changes: 10 additions & 1 deletion app/src/server/api/routers/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ export const homeRouter = createTRPCRouter({
.input(z.object({
homeTypeId: z.string(),
}))
.output(baseServerResponse)
.output(baseServerResponse.extend({
home: z.object({
id: z.string(),
name: z.string(),
regenBonus: z.number(),
storageSlots: z.number(),
cost: z.number(),
}).optional(),
}))
.mutation(async ({ ctx, input }) => {
const { user } = await fetchUpdatedUser({
client: ctx.drizzle,
Expand Down Expand Up @@ -118,6 +126,7 @@ export const homeRouter = createTRPCRouter({
return {
success: true,
message: `Successfully upgraded to ${selectedHome.name}`,
home: selectedHome,
};
}),

Expand Down
12 changes: 12 additions & 0 deletions app/src/server/api/routers/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,11 @@ export const fetchUpdatedUser = async (props: {
relationshipB: true,
},
},
home: {
with: {
homeType: true,
},
},
anbuSquad: {
columns: { name: true },
},
Expand Down Expand Up @@ -1650,6 +1655,13 @@ export type UserWithRelations =
loadout?: { jutsuIds: string[] } | null;
userQuests: UserQuest[];
votes?: UserVote | null;
home?: {
id: string;
name: string;
regenBonus: number;
storageSlots: number;
cost: number;
} | null;
})
| undefined;

Expand Down

0 comments on commit c4ba4c7

Please sign in to comment.