mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-11 00:05:36 +02:00
## Description - [x] Adds support for AWS SSO, which makes us (the team) able to use SST and update the components independently - [x] Splits the webpage into the landing page (Qwik), and Astro (the console) in charge of playing. This allows us to pass in Environment Variables to the console - ~Migrates the docs from Nuxt to Nextjs, and connects them to SST. This allows us to use Fumadocs _citation needed_ that's much more beautiful, and supports OpenApi~ - Cloudflare pages with github integration is not working on our new CF account. So we will have to push the pages deployment manually with Github actions - [x] Moves the current set up from my personal CF and AWS accounts to dedicated Nestri accounts - ## Related Issues <!-- List any related issues (e.g., "Closes #123", "Fixes #456") --> ## Type of Change - [ ] Bug fix (non-breaking change) - [x] New feature (non-breaking change) - [ ] Breaking change (fix or feature that changes existing functionality) - [x] Documentation update - [ ] Other (please describe): ## Checklist - [x] I have updated relevant documentation - [x] My code follows the project's coding style - [x] My changes generate no new warnings/errors ## Notes for Reviewers <!-- Point out areas you'd like reviewers to focus on, questions you have, or decisions that need discussion --> Please approve my PR 🥹 ## Screenshots/Demo <!-- If applicable, add screenshots or a GIF demo of your changes (especially for UI changes) --> ## Additional Context <!-- Add any other context about the pull request here -->
151 lines
4.5 KiB
TypeScript
151 lines
4.5 KiB
TypeScript
// import { z } from "zod"
|
|
// import { fn } from "../utils";
|
|
// import { Common } from "../common";
|
|
// import { Examples } from "../examples";
|
|
// import databaseClient from "../database"
|
|
// import { id as createID } from "@instantdb/admin";
|
|
// import { groupBy, map, pipe, values } from "remeda"
|
|
// import { useCurrentDevice, useCurrentUser } from "../actor";
|
|
|
|
// export module Games {
|
|
// export const Info = z
|
|
// .object({
|
|
// id: z.string().openapi({
|
|
// description: Common.IdDescription,
|
|
// example: Examples.Game.id,
|
|
// }),
|
|
// name: z.string().openapi({
|
|
// description: "A human-readable name for the game, used for easy identification.",
|
|
// example: Examples.Game.name,
|
|
// }),
|
|
// steamID: z.number().openapi({
|
|
// description: "The Steam ID of the game, used to identify it during installation and runtime.",
|
|
// example: Examples.Game.steamID,
|
|
// })
|
|
// })
|
|
// .openapi({
|
|
// ref: "Game",
|
|
// description: "Represents a Steam game that can be installed and played on a machine.",
|
|
// example: Examples.Game,
|
|
// });
|
|
|
|
// export type Info = z.infer<typeof Info>;
|
|
|
|
// export const create = fn(Info.pick({ name: true, steamID: true }), async (input) => {
|
|
// const id = createID()
|
|
// const db = databaseClient()
|
|
// const device = useCurrentDevice()
|
|
|
|
// await db.transact(
|
|
// db.tx.games[id]!.update({
|
|
// name: input.name,
|
|
// steamID: input.steamID,
|
|
// }).link({ machines: device.id })
|
|
// )
|
|
// //
|
|
// return id
|
|
// })
|
|
|
|
// export const list = async () => {
|
|
// const db = databaseClient()
|
|
// const user = useCurrentUser()
|
|
|
|
// const query = {
|
|
// $users: {
|
|
// $: { where: { id: user.id } },
|
|
// games: {}
|
|
// },
|
|
// }
|
|
|
|
// const res = await db.query(query)
|
|
|
|
// const games = res.$users[0]?.games
|
|
// if (games && games.length > 0) {
|
|
// const result = pipe(
|
|
// games,
|
|
// groupBy(x => x.id),
|
|
// values(),
|
|
// map((group): Info => ({
|
|
// id: group[0].id,
|
|
// name: group[0].name,
|
|
// steamID: group[0].steamID,
|
|
// }))
|
|
// )
|
|
// return result
|
|
// }
|
|
// return null
|
|
// }
|
|
|
|
// export const fromSteamID = fn(z.number(), async (steamID) => {
|
|
// const db = databaseClient()
|
|
|
|
// const query = {
|
|
// games: {
|
|
// $: {
|
|
// where: {
|
|
// steamID,
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// const res = await db.query(query)
|
|
|
|
// const games = res.games
|
|
|
|
// if (games.length > 0) {
|
|
// const result = pipe(
|
|
// games,
|
|
// groupBy(x => x.id),
|
|
// values(),
|
|
// map((group): Info => ({
|
|
// id: group[0].id,
|
|
// name: group[0].name,
|
|
// steamID: group[0].steamID,
|
|
// }))
|
|
// )
|
|
// return result[0]
|
|
// }
|
|
|
|
// return null
|
|
// })
|
|
|
|
// export const linkToCurrentUser = fn(z.string(), async (steamID) => {
|
|
// const user = useCurrentUser()
|
|
// const db = databaseClient()
|
|
|
|
// await db.transact(db.tx.games[steamID]!.link({ owners: user.id }))
|
|
|
|
// return "ok"
|
|
// })
|
|
|
|
// export const unLinkFromCurrentUser = fn(z.number(), async (steamID) => {
|
|
// const user = useCurrentUser()
|
|
// const db = databaseClient()
|
|
|
|
// const query = {
|
|
// $users: {
|
|
// $: { where: { id: user.id } },
|
|
// games: {
|
|
// $: {
|
|
// where: {
|
|
// steamID,
|
|
// }
|
|
// }
|
|
// }
|
|
// },
|
|
// }
|
|
|
|
// const res = await db.query(query)
|
|
// const games = res.$users[0]?.games
|
|
// if (games && games.length > 0) {
|
|
// const game = games[0] as Info
|
|
// await db.transact(db.tx.games[game.id]!.unlink({ owners: user.id }))
|
|
|
|
// return "ok"
|
|
// }
|
|
|
|
// return null
|
|
// })
|
|
|
|
// }
|