@candlerip/shared3 0.0.164 → 0.0.165
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/backend/database/model/contact/contact-db-schema.d.ts +42 -0
- package/src/backend/database/model/contact/contact-db-schema.js +10 -0
- package/src/backend/database/model/contact/get-contact-db-model.d.ts +2 -0
- package/src/backend/database/model/contact/get-contact-db-model.js +3 -0
- package/src/backend/database/model/contact/index.d.ts +2 -0
- package/src/backend/database/model/contact/index.js +2 -0
- package/src/backend/database/model/index.d.ts +1 -0
- package/src/backend/database/model/index.js +1 -0
- package/src/backend/database/mutation/contact/create-contact/index.d.ts +2 -0
- package/src/backend/database/mutation/contact/create-contact/index.js +17 -0
- package/src/backend/database/mutation/contact/create-contact/type.d.ts +6 -0
- package/src/backend/database/mutation/contact/create-contact/type.js +1 -0
- package/src/backend/database/mutation/contact/index.d.ts +1 -0
- package/src/backend/database/mutation/contact/index.js +1 -0
- package/src/backend/database/mutation/index.d.ts +1 -0
- package/src/backend/database/mutation/index.js +1 -0
- package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/index.js +4 -1
- package/src/backend/server/server-data/persons-map/compose-persons-map-page-server-data/index.js +7 -7
- package/src/backend/server/server-data/persons-map/compose-persons-map-page-server-data/type.d.ts +3 -2
- package/src/contact/index.d.ts +1 -0
- package/src/contact/index.js +1 -0
- package/src/contact/type.d.ts +9 -0
- package/src/contact/type.js +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
import * as mongoose from 'mongoose';
|
2
|
+
export declare const ContactDbSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
3
|
+
timestamps: true;
|
4
|
+
versionKey: false;
|
5
|
+
}, {
|
6
|
+
createdAt: NativeDate;
|
7
|
+
updatedAt: NativeDate;
|
8
|
+
} & {
|
9
|
+
email?: string | null | undefined;
|
10
|
+
message?: string | null | undefined;
|
11
|
+
name?: string | null | undefined;
|
12
|
+
subject?: string | null | undefined;
|
13
|
+
date?: NativeDate | null | undefined;
|
14
|
+
id?: number | null | undefined;
|
15
|
+
logId?: string | null | undefined;
|
16
|
+
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
17
|
+
createdAt: NativeDate;
|
18
|
+
updatedAt: NativeDate;
|
19
|
+
} & {
|
20
|
+
email?: string | null | undefined;
|
21
|
+
message?: string | null | undefined;
|
22
|
+
name?: string | null | undefined;
|
23
|
+
subject?: string | null | undefined;
|
24
|
+
date?: NativeDate | null | undefined;
|
25
|
+
id?: number | null | undefined;
|
26
|
+
logId?: string | null | undefined;
|
27
|
+
}>> & mongoose.FlatRecord<{
|
28
|
+
createdAt: NativeDate;
|
29
|
+
updatedAt: NativeDate;
|
30
|
+
} & {
|
31
|
+
email?: string | null | undefined;
|
32
|
+
message?: string | null | undefined;
|
33
|
+
name?: string | null | undefined;
|
34
|
+
subject?: string | null | undefined;
|
35
|
+
date?: NativeDate | null | undefined;
|
36
|
+
id?: number | null | undefined;
|
37
|
+
logId?: string | null | undefined;
|
38
|
+
}> & {
|
39
|
+
_id: mongoose.Types.ObjectId;
|
40
|
+
} & {
|
41
|
+
__v: number;
|
42
|
+
}>;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as mongoose from 'mongoose';
|
2
|
+
export const ContactDbSchema = new mongoose.Schema({
|
3
|
+
id: { type: Number },
|
4
|
+
email: { type: String },
|
5
|
+
message: { type: String },
|
6
|
+
date: { type: Date },
|
7
|
+
logId: { type: String },
|
8
|
+
name: { type: String },
|
9
|
+
subject: { type: String },
|
10
|
+
}, { timestamps: true, versionKey: false });
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { customErrorWorker } from '@candlerip/shared3';
|
2
|
+
import { getContactDbModel } from '../../../model/index.js';
|
3
|
+
export const createContact = async (contact) => {
|
4
|
+
let data;
|
5
|
+
const { composeCustomError } = customErrorWorker({ contact });
|
6
|
+
try {
|
7
|
+
data = await getContactDbModel().create(contact);
|
8
|
+
}
|
9
|
+
catch (err) {
|
10
|
+
return {
|
11
|
+
customError: composeCustomError('Create contact failed', { err }),
|
12
|
+
};
|
13
|
+
}
|
14
|
+
return {
|
15
|
+
data,
|
16
|
+
};
|
17
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './create-contact/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './create-contact/index.js';
|
package/src/backend/dictionary/translation-id/excluded/compose-excluded-translation-ids/index.js
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
import { isPageMenu } from '../../../../../page/index.js';
|
2
|
+
import { isUndefined } from '../../../../../type/index.js';
|
2
3
|
import { EXCLUDED_TRANSLATION_IDS } from '../config.js';
|
3
4
|
export const composeExcludedTranslationIds = (page, options) => {
|
4
5
|
let excludedIds = [];
|
5
6
|
if (options) {
|
6
7
|
const { isAuthenticated, isCookieConsent } = options;
|
7
|
-
|
8
|
+
if (!isUndefined(isAuthenticated)) {
|
9
|
+
excludedIds.push(isAuthenticated ? 'login' : 'logout');
|
10
|
+
}
|
8
11
|
if (isCookieConsent) {
|
9
12
|
excludedIds = excludedIds.concat(EXCLUDED_TRANSLATION_IDS.cookieConsent);
|
10
13
|
}
|
package/src/backend/server/server-data/persons-map/compose-persons-map-page-server-data/index.js
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import { getTranslationsAsDictionary } from '../../../../database/index.js';
|
1
|
+
import { composeDictionary } from '../../../../dictionary/index.js';
|
3
2
|
import { composePersonsMapPageData } from '../../../../page/index.js';
|
4
|
-
export const composePersonsMapPageServerData = async (
|
3
|
+
export const composePersonsMapPageServerData = async (language, options) => {
|
4
|
+
const excludedTranslationIdOptions = options?.excludedTranslationIdOptions;
|
5
5
|
let resp;
|
6
|
-
resp = await
|
6
|
+
resp = await composePersonsMapPageData();
|
7
7
|
if ('customError' in resp) {
|
8
8
|
return resp;
|
9
9
|
}
|
10
|
-
const
|
11
|
-
resp = await
|
10
|
+
const pageData = resp.data;
|
11
|
+
resp = await composeDictionary('persons-map-page', language, { excludedTranslationIdOptions });
|
12
12
|
if ('customError' in resp) {
|
13
13
|
return resp;
|
14
14
|
}
|
15
|
-
const
|
15
|
+
const dictionary = resp.data;
|
16
16
|
return {
|
17
17
|
data: {
|
18
18
|
dictionary,
|
package/src/backend/server/server-data/persons-map/compose-persons-map-page-server-data/type.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Language } from '../../../../../dictionary/index.js';
|
2
2
|
import { CustomError } from '../../../../../error/index.js';
|
3
|
+
import { ExcludedTranslationIdOptions } from '../../../../dictionary/index.js';
|
3
4
|
import { PersonsMapPageServerData } from '../type.js';
|
4
|
-
export type ComposePersonsMapPageServerData = (
|
5
|
-
|
5
|
+
export type ComposePersonsMapPageServerData = (language: Language, options?: {
|
6
|
+
excludedTranslationIdOptions?: ExcludedTranslationIdOptions;
|
6
7
|
}) => Promise<{
|
7
8
|
data: PersonsMapPageServerData;
|
8
9
|
} | {
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './type.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/src/index.d.ts
CHANGED