Browse Source

refactor: rewrite /apps/:id to /app-store/:id

Nicolas Meienberger 1 năm trước cách đây
mục cha
commit
91c857c810

+ 8 - 0
next.config.mjs

@@ -23,6 +23,14 @@ const nextConfig = {
     NODE_ENV: process.env.NODE_ENV,
     REDIS_HOST: process.env.REDIS_HOST,
   },
+  async rewrites() {
+    return [
+      {
+        source: '/apps/:id',
+        destination: '/app-store/:id',
+      },
+    ];
+  },
 };
 
 export default nextConfig;

+ 1 - 0
src/client/mocks/handlers.ts

@@ -34,6 +34,7 @@ export const handlers = [
       id: faker.number.int(),
       username: faker.internet.userName(),
       locale: 'en',
+      operator: true,
     },
   }),
   // App

+ 0 - 19
src/pages/apps/[id].tsx

@@ -1,19 +0,0 @@
-import merge from 'lodash.merge';
-import { getAuthedPageProps, getMessagesPageProps } from '@/utils/page-helpers';
-import { GetServerSideProps } from 'next';
-
-export { AppDetailsPage as default } from '../../client/modules/Apps/pages/AppDetailsPage';
-
-export const getServerSideProps: GetServerSideProps = async (ctx) => {
-  const authedProps = await getAuthedPageProps(ctx);
-  const messagesProps = await getMessagesPageProps(ctx);
-
-  const { id } = ctx.query;
-  const appId = String(id);
-
-  return merge(authedProps, messagesProps, {
-    props: {
-      appId,
-    },
-  });
-};

+ 1 - 1
src/server/queries/auth/auth.queries.ts

@@ -33,7 +33,7 @@ export class AuthQueries {
    * @param {number} id - The id of the user to return
    */
   public async getUserDtoById(id: number) {
-    return this.db.query.userTable.findFirst({ where: eq(userTable.id, Number(id)), columns: { id: true, username: true, totpEnabled: true, locale: true } });
+    return this.db.query.userTable.findFirst({ where: eq(userTable.id, Number(id)), columns: { id: true, username: true, totpEnabled: true, locale: true, operator: true } });
   }
 
   /**