Skip to content

Commit 9029806

Browse files
Resul AvanResul Avan
authored andcommitted
service, type, function refactoring
1 parent 803d1ef commit 9029806

28 files changed

+172
-144
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ See the [Features](#features) for more functionalities
6464
- [x] firebase-functions
6565
- [x] performance configuration
6666
- [x] the url same as hosting
67+
- [x] dynamic sitemap
6768
- [x] firebase-storage
6869
- [x] profile picture
6970
- [x] firebase-auth
@@ -91,6 +92,10 @@ See the [Features](#features) for more functionalities
9192
- [x] Turkish
9293
- [x] vee-validate
9394
- [x] integration with nuxt-i18n
95+
- [x] SEO
96+
- [x] Google meta
97+
- [x] Facebook meta
98+
- [x] Twitter card meta
9499
- [x] redirect to next url after login
95100
- [x] custom loading component
96101
- [x] dotenv

functions/src/api/authApi.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import express, { Request, Response, Router } from 'express';
22
import { addDecodedIdToken } from '../service/firebase-admin-utils';
3-
import { AnonymousUserImage, runtimeOpts, StoredUser } from '../types'
3+
import { AnonymousUserImage, StoredUser } from '../types'
44
import admin from '../service/firebase-admin-init';
55
import { FirebaseError } from "firebase-admin";
6-
import { runWith } from "firebase-functions";
6+
import { RuntimeOptions, runWith } from "firebase-functions";
77
import cookieParser from "cookie-parser";
88

99
const service = '/auth';
@@ -51,11 +51,17 @@ router.post(service, async (req: Request, res: Response) => {
5151

5252
return res.status(200).json(user);
5353
})
54-
.catch((error) => handleFirebaseError(res, error, '/api'+service));
54+
.catch((error) => handleFirebaseError(res, error, '/api' + service));
5555
});
5656

5757
app.use('/api', router)
5858

59+
const runtimeOpts: RuntimeOptions = {
60+
timeoutSeconds: 300,
61+
memory: '1GB',
62+
maxInstances: 1
63+
}
64+
5965
export const authApi = runWith(runtimeOpts)
6066
.https
6167
.onRequest(app);

functions/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { nuxtOnFunction } from './nuxt-server'
22
export { authApi } from './api/authApi'
3-
export { sitemapApp } from './api/sitemap'
3+
export { sitemapApp } from './sitemap'

functions/src/nuxt-server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { runWith } from "firebase-functions";
1+
import { RuntimeOptions, runWith } from "firebase-functions";
22
import cookieParser from 'cookie-parser'
3-
import { runtimeOpts } from './types'
43
import express, { Request, Response } from 'express'
54

65
const { Nuxt } = require('nuxt');
@@ -46,6 +45,12 @@ app.use(cookieParser())
4645
app.get('*', handleRequest)
4746
app.use(handleRequest)
4847

48+
const runtimeOpts: RuntimeOptions = {
49+
timeoutSeconds: 300,
50+
memory: '2GB',
51+
maxInstances: 1
52+
}
53+
4954
export const nuxtOnFunction = runWith(runtimeOpts)
5055
.https
5156
.onRequest(app);

functions/src/api/sitemap.ts renamed to functions/src/sitemap.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import express, { Request, Response, Router } from 'express';
22
import { SitemapStream, streamToPromise } from 'sitemap';
33
import { createGzip } from 'zlib'
4-
import { runWith } from "firebase-functions";
5-
import { runtimeOpts } from "../types";
4+
import { RuntimeOptions, runWith } from "firebase-functions";
65

76
const service = '/sitemap.xml';
87
const app = express();
@@ -45,6 +44,11 @@ router.get(service, (req: Request, res: Response) => {
4544

4645
app.use(router)
4746

47+
const runtimeOpts: RuntimeOptions = {
48+
timeoutSeconds: 300,
49+
maxInstances: 1
50+
}
51+
4852
export const sitemapApp = runWith(runtimeOpts)
4953
.https
5054
.onRequest(app);

functions/src/types.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { RuntimeOptions } from "firebase-functions";
2-
31
export interface Image {
42
src: string;
53
alt: string
@@ -8,7 +6,7 @@ export interface Image {
86
export const AnonymousUserImage: Image = {
97
src: '/img/anonymous-user.svg',
108
alt: 'anonymous user picture'
11-
};
9+
}
1210

1311
export interface StoredUser {
1412
name: string
@@ -18,9 +16,3 @@ export interface StoredUser {
1816
verified: boolean
1917
providers: string[]
2018
}
21-
22-
export const runtimeOpts: RuntimeOptions = {
23-
timeoutSeconds: 300,
24-
memory: '1GB',
25-
maxInstances: 1
26-
};

src/components/form/SocialLogin.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<script lang="ts">
2424
import { Component, Prop, Vue } from 'nuxt-property-decorator';
2525
import { ProviderConfig, ProviderType, SocialLoginCredentials, StateNamespace } from "~/types";
26-
import { getProviderOption } from "~/service/helper/firebaseHelper";
26+
import { getProviderOption } from "~/service/firebase-service";
2727
import RememberMe from "~/components/ui/RememberMe.vue";
2828
2929
@Component({

src/components/image/upload/SingleFileUpload.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
<script lang="ts">
1212
import { Component, Prop, Vue, Watch } from 'nuxt-property-decorator';
13-
import { getNewFileName, handleError } from "~/service/helper/global-helpers";
13+
import { getNewFileName } from "~/service/global-service";
1414
import { storage, TaskEvent, TaskState } from "~/plugins/fire-init-plugin";
15+
import { handleError } from "~/service/error-service";
1516
1617
@Component({
1718
components: {}

src/components/profile/ProviderList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SupportedProviders
2323
} from "~/types";
2424
import { showWarningToaster } from "~/service/notification-service";
25-
import { getProviderOption } from "~/service/helper/firebaseHelper";
25+
import { getProviderOption } from "~/service/firebase-service";
2626
2727
@Component({
2828
components: { Provider }

src/middleware/router-auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Middleware } from "@nuxt/types";
22
import { RouteQueryParameters, RouteType } from "~/types";
3-
import { authenticatedAllowed, authenticatedNotAllowed } from "~/service/helper/global-helpers";
3+
import { authenticatedAllowed, authenticatedNotAllowed } from "~/service/global-service";
44

55
const routerAuthMiddleware: Middleware = ({ store, redirect, route }) => {
66
console.log('routerAuthMiddleware', route.fullPath, route.query, store.state.auth.user)

0 commit comments

Comments
 (0)