misc fixes

This commit is contained in:
Jorge Vargas 2024-09-18 20:33:41 -06:00
parent 7aa64366c0
commit 971d4f2ce6
41 changed files with 18860 additions and 85 deletions

View file

@ -2,6 +2,5 @@
"recommendations": [
"astro-build.astro-vscode",
"inlang.vs-code-extension"
],
"unwantedRecommendations": []
]
}

View file

@ -1,3 +1,4 @@
// @ts-check
import { defineConfig } from 'astro/config'
import tailwind from '@astrojs/tailwind'
import node from '@astrojs/node'
@ -21,18 +22,9 @@ export default defineConfig({
integrations: [
tailwind(),
auth(),
paraglide({
// recommended settings
project: './project.inlang',
outdir: './src/paraglide' //where your files should be
}),
paraglide({ project: './project.inlang', outdir: './src/paraglide' }),
icon({ iconDir: 'src/img/icons' })
],
output: 'server',
adapter: node({
mode: 'standalone'
}),
image: {
domains: ['cdn.sittingonclouds.net']
}
adapter: node({ mode: 'standalone' })
})

View file

@ -3,7 +3,7 @@ import { defineConfig } from 'auth-astro'
import Credentials from "@auth/core/providers/credentials"
import bcrypt from 'bcrypt'
import User from '@/sequelize/models/user'
import User from 'sequelize/models/user'
declare module "@auth/core" {
interface Session {

18736
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
"scripts": {
"dev": "concurrently \"npm:gql:watch\" \"npm:astro:dev\"",
"astro:dev": "astro dev",
"build": "npm run paraglide:compile && npm run gql:compile && astro check && astro build",
"build": "npm run paraglide:compile && npm run gql:compile && astro build",
"preview": "astro preview",
"astro": "astro",
"gql:compile": "graphql-codegen",
@ -14,11 +14,11 @@
},
"dependencies": {
"@apollo/client": "^3.11.4",
"@astrojs/check": "^0.9.2",
"@astrojs/node": "^8.3.2",
"@astrojs/check": "^0.9.3",
"@astrojs/node": "^8.3.3",
"@astrojs/rss": "^4.0.7",
"@astrojs/tailwind": "^5.1.0",
"@auth/core": "^0.32.0",
"@astrojs/tailwind": "^5.1.1",
"@auth/core": "^0.35.0",
"@eddeee888/gcg-typescript-resolver-files": "^0.10.4",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-tools/load-files": "^7.0.0",
@ -28,9 +28,12 @@
"@inlang/paraglide-astro": "^0.2.2",
"@sequelize/core": "^7.0.0-alpha.37",
"@sequelize/mysql": "^7.0.0-alpha.41",
"lodash": "^4.17.21",
"astro": "^4.15.7",
"astro-icon": "^1.1.1",
"auth-astro": "^4.1.2",
"bcrypt": "^5.1.1",
"graphql-scalars": "^1.23.0",
"lodash": "^4.17.21",
"tailwindcss": "^3.4.12",
"typescript": "^5.6.2"
},
@ -48,4 +51,4 @@
"prettier-config-standard": "^7.0.0",
"prettier-plugin-astro": "^0.14.1"
}
}
}

View file

@ -1,12 +1,12 @@
---
import { gql } from '@/graphql/__generated__/client'
import { gql } from '@/graphql/__generated__/client/index.js'
import { getApolloClient } from '@/graphql/apolloClient.mjs'
import { Image, Picture } from 'astro:assets'
import { getSession } from 'auth-astro/server'
import * as m from '../paraglide/messages.js'
import logo from '@/img/logos/winter.png'
// import logoEs from '@/img/logos/default_es.png'
import logo from 'img/logos/winter.png'
// import logoEs from 'img/logos/default_es.png'
import Button from './Button.astro'
import Dropdown from './header/Dropdown.astro'

1
src/env.d.ts vendored
View file

@ -1,2 +1 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View file

@ -2,7 +2,21 @@
import * as types from './graphql';
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
const documents = [];
/**
* Map of all GraphQL operations in the project.
*
* This map has several performance disadvantages:
* 1. It is not tree-shakeable, so it will include all operations in the project.
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
* 3. It does not support dead code elimination, so it will add unused operations.
*
* Therefore it is highly recommended to use the babel or swc plugin for production.
*/
const documents = {
"\n query HeaderInfo {\n banner: config(name: \"banner\") {\n value\n }\n bannerPosition: config(name: \"banner-position\") {\n value\n }\n }\n ": types.HeaderInfoDocument,
"\n query LastAdded ($limit: Int) {\n added: searchAlbum(limit: $limit, status: [\"show\"]) {\n rows {\n id\n createdAt\n title\n subTitle\n artists {\n name\n }\n }\n }\n }\n": types.LastAddedDocument,
};
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*
@ -17,6 +31,15 @@ const documents = [];
*/
export function gql(source: string): unknown;
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n query HeaderInfo {\n banner: config(name: \"banner\") {\n value\n }\n bannerPosition: config(name: \"banner-position\") {\n value\n }\n }\n "): (typeof documents)["\n query HeaderInfo {\n banner: config(name: \"banner\") {\n value\n }\n bannerPosition: config(name: \"banner-position\") {\n value\n }\n }\n "];
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n query LastAdded ($limit: Int) {\n added: searchAlbum(limit: $limit, status: [\"show\"]) {\n rows {\n id\n createdAt\n title\n subTitle\n artists {\n name\n }\n }\n }\n }\n"): (typeof documents)["\n query LastAdded ($limit: Int) {\n added: searchAlbum(limit: $limit, status: [\"show\"]) {\n rows {\n id\n createdAt\n title\n subTitle\n artists {\n name\n }\n }\n }\n }\n"];
export function gql(source: string) {
return (documents as any)[source] ?? {};
}

View file

@ -1,4 +1,5 @@
/* eslint-disable */
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
@ -926,3 +927,19 @@ export type VgmResult = {
title?: Maybe<Scalars['String']['output']>;
trackList: Array<Maybe<VgmdbDisc>>;
};
export type HeaderInfoQueryVariables = Exact<{ [key: string]: never; }>;
export type HeaderInfoQuery = { __typename?: 'Query', banner?: { __typename?: 'Config', value?: string | null } | null, bannerPosition?: { __typename?: 'Config', value?: string | null } | null };
export type LastAddedQueryVariables = Exact<{
limit?: InputMaybe<Scalars['Int']['input']>;
}>;
export type LastAddedQuery = { __typename?: 'Query', added?: { __typename?: 'SearchAlbumResult', rows?: Array<{ __typename?: 'Album', id: string, createdAt: number, title: string, subTitle?: string | null, artists: Array<{ __typename?: 'Artist', name: string } | null> } | null> | null } | null };
export const HeaderInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"HeaderInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"banner"},"name":{"kind":"Name","value":"config"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"StringValue","value":"banner","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"bannerPosition"},"name":{"kind":"Name","value":"config"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"StringValue","value":"banner-position","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]} as unknown as DocumentNode<HeaderInfoQuery, HeaderInfoQueryVariables>;
export const LastAddedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"LastAdded"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"added"},"name":{"kind":"Name","value":"searchAlbum"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"status"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"show","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rows"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"subTitle"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<LastAddedQuery, LastAddedQueryVariables>;

View file

@ -8,7 +8,7 @@ import type { Session } from '@auth/core/types';
import { typeDefs } from "./__generated__/typeDefs.generated";
import resolvers from '@/graphql/resolvers'
import db from '@/sequelize';
import db from 'sequelize';
const schema = makeExecutableSchema({ typeDefs, resolvers })
export type ResolverContext = { request?: Request, session?: Session }

View file

@ -1,8 +1,8 @@
import { composeResolvers } from '@graphql-tools/resolvers-composition'
// import axios from 'axios'
import { isAuthedApp } from '@/server/utils/resolvers'
import { getSession, getUser } from '@/next/utils/getSession'
import { isAuthedApp } from 'server/utils/resolvers'
import { getSession, getUser } from 'next/utils/getSession'
// const token = process.env.IRONCLAD

View file

@ -1,11 +1,11 @@
import { composeResolvers } from '@graphql-tools/resolvers-composition'
import { createLog, createUpdateLog } from '@/server/utils/log'
import { getImgColor, img } from '@/server/utils/image'
import { hasRole } from '@/server/utils/resolvers'
import { handleComplete } from '@/server/utils/requests'
import { slugify } from '@/server/utils/slugify'
import { UserInputError } from '@/next/server/utils/graphQLErrors'
import { createLog, createUpdateLog } from 'server/utils/log'
import { getImgColor, img } from 'server/utils/image'
import { hasRole } from 'server/utils/resolvers'
import { handleComplete } from 'server/utils/requests'
import { slugify } from 'server/utils/slugify'
import { UserInputError } from 'next/server/utils/graphQLErrors'
const resolversComposition = { 'Mutation.*': hasRole('CREATE') }
const resolvers = {

View file

@ -1,10 +1,10 @@
import { composeResolvers } from '@graphql-tools/resolvers-composition'
import { mergeResolvers } from '@graphql-tools/merge'
import { hasRole, isAuthedApp } from '@/server/utils/resolvers'
import { getUser } from '@/next/utils/getSession'
import { requestPOST } from '@/server/utils/requests'
import { UserInputError } from '@/next/server/utils/graphQLErrors'
import { hasRole, isAuthedApp } from 'server/utils/resolvers'
import { getUser } from 'next/utils/getSession'
import { requestPOST } from 'server/utils/requests'
import { UserInputError } from 'next/server/utils/graphQLErrors'
const resolvers = {
Mutation: {

View file

@ -2,9 +2,9 @@ import { composeResolvers } from '@graphql-tools/resolvers-composition'
import fs from 'fs-extra'
import path from 'path'
import { img } from '@/server/utils/image'
import { hasRole } from '@/server/utils/resolvers'
import { UserInputError } from '@/next/server/utils/graphQLErrors'
import { img } from 'server/utils/image'
import { hasRole } from 'server/utils/resolvers'
import { UserInputError } from 'next/server/utils/graphQLErrors'
const resolversComposition = { 'Mutation.*': hasRole('UPDATE') }
const resolvers = {

View file

@ -1,10 +1,10 @@
import { composeResolvers } from '@graphql-tools/resolvers-composition'
import { createLog, createUpdateLog } from '@/server/utils/log'
import { img, getImgColor } from '@/server/utils/image'
import { hasRole } from '@/server/utils/resolvers'
import { handleComplete } from '@/server/utils/requests'
import { slugify } from '@/server/utils/slugify'
import { createLog, createUpdateLog } from 'server/utils/log'
import { img, getImgColor } from 'server/utils/image'
import { hasRole } from 'server/utils/resolvers'
import { handleComplete } from 'server/utils/requests'
import { slugify } from 'server/utils/slugify'
const resolversComposition = { 'Mutation.*': hasRole('UPDATE') }
const resolvers = {

View file

@ -1,4 +1,4 @@
import Sequelize from '@/sequelize'
import Sequelize from 'sequelize'
const { Op } = Sequelize

View file

@ -1,4 +1,4 @@
import { Op, fn, col, where } from '@/sequelize'
import { Op, fn, col, where } from 'sequelize'
const resolvers = {
Query: {

View file

@ -1,8 +1,8 @@
import { Op, literal } from '@sequelize/core'
import type { Resolvers } from '@/graphql/__generated__/types.generated'
import Category from '@/sequelize/models/category'
import Album from '@/sequelize/models/album'
import Category from 'sequelize/models/category'
import Album from 'sequelize/models/album'
const fuzzySearch = (words: string[]) => `^${words.map(w => `(?=.*\b${w}\b)`)}.+/i`

View file

@ -2,9 +2,9 @@
import type { Resolvers } from '@/graphql/__generated__/types.generated'
import { composeResolvers } from '@graphql-tools/resolvers-composition'
import Config from '@/sequelize/models/config'
import Config from 'sequelize/models/config'
// import { hasRole } from '@/server/utils/resolvers'
// import { hasRole } from 'server/utils/resolvers'
const resolversComposition = {
/* 'Query.banners': hasRole('UPDATE') */
@ -30,11 +30,11 @@ const images = filePaths.map((f) => f.split('/').pop())
return images
},
recentComments: async (parent, { limit = 5 }, { db }) => {
return db.models.comment.findAll({
limit,
order: [['updatedAt', 'DESC']]
})
recentComments: async (parent, { limit = 5 }, { db }) => {
return db.models.comment.findAll({
limit,
order: [['updatedAt', 'DESC']]
})
} */
}
}

View file

@ -1,9 +1,9 @@
import { Op } from 'sequelize'
import { composeResolvers } from '@graphql-tools/resolvers-composition'
import info from '@/next/constants/info.json'
import { hasRole } from '@/server/utils/resolvers'
import { getUser } from '@/next/utils/getSession'
import info from 'next/constants/info.json'
import { hasRole } from 'server/utils/resolvers'
import { getUser } from 'next/utils/getSession'
const { permissions } = info

View file

@ -1,6 +1,6 @@
// import { GraphQLUpload } from 'graphql-upload-minimal'
import type { Resolvers } from "@/graphql/__generated__/types.generated"
import type Album from "@/sequelize/models/album"
import type Album from "sequelize/models/album"
const resolvers: Resolvers = {
// Upload: GraphQLUpload,

View file

@ -1,9 +1,9 @@
---
import { languageTag } from '../paraglide/runtime'
import Header from '@/components/Header.astro'
import Header from 'components/Header.astro'
import '@/styles/global.css'
import 'styles/global.css'
---
<html lang={languageTag()} dir={Astro.locals.paraglide.dir} class='h-full'>

View file

@ -1,7 +1,7 @@
---
import { languageTag } from '../paraglide/runtime'
import BaseLayout from '@/layouts/base.astro'
import BaseLayout from 'layouts/base.astro'
---
<BaseLayout />

View file

@ -4,7 +4,7 @@ import { Sequelize, type ModelStatic, type Options } from '@sequelize/core'
const envOptions: Options<MySqlDialect> = JSON.parse(import.meta.env.SEQUELIZE) || {}
const db = new Sequelize({
...envOptions,
models: Object.values<ModelStatic>(await import.meta.glob('@/sequelize/models/**/*.ts', { eager: true, import: 'default' }))
models: Object.values<ModelStatic>(await import.meta.glob('sequelize/models/**/*.ts', { eager: true, import: 'default' }))
})
export default db

View file

@ -1,5 +1,5 @@
import { DataTypes } from '@/sequelize'
import { PLACEHOLDER } from '@/constants'
import { DataTypes } from 'sequelize'
import { PLACEHOLDER } from 'constants'
const animation = (sequelize) => {
sequelize.define(

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Classification = sequelize.define(
'classification',

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
sequelize.define('comment', {

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Disc = sequelize.define('disc', {
number: DataTypes.INTEGER,

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Download = sequelize.define('download', {
title: DataTypes.STRING,

View file

@ -1,5 +1,5 @@
import { DataTypes } from '@/sequelize'
import { PLACEHOLDER } from '@/constants'
import { DataTypes } from 'sequelize'
import { PLACEHOLDER } from 'constants'
const model = (sequelize) => {
const Game = sequelize.define(

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Link = sequelize.define('link', {
url: DataTypes.STRING,

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
return sequelize.define('log', {
id: {

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Platform = sequelize.define(
'platform',

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Publisher = sequelize.define(
'publisher',

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const request = (sequelize) =>
sequelize.define('request', {

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Role = sequelize.define('role', {
name: {

View file

@ -1,5 +1,5 @@
import { DataTypes } from '@/sequelize'
import { PLACEHOLDER } from '@/constants'
import { DataTypes } from 'sequelize'
import { PLACEHOLDER } from 'constants'
const model = (sequelize) => {
const Series = sequelize.define(

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) => {
const Store = sequelize.define('store', {
url: DataTypes.STRING,

View file

@ -1,4 +1,4 @@
import { DataTypes } from '@/sequelize'
import { DataTypes } from 'sequelize'
const model = (sequelize) =>
sequelize.define('submission', {

View file

@ -1,5 +1,5 @@
import User from "@/sequelize/models/user";
import User from "sequelize/models/user";
import type { Session } from "@auth/core";
export async function getUser(session: Session | null) {

View file

@ -1,8 +1,14 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"experimentalDecorators": true,
"moduleResolution": "Bundler",
"allowJs": true,
"baseUrl": "src",
"paths": {
"@/graphql/*": [
"graphql/*"
],
}
}
}