@aeriajs/builtins 0.0.233 → 0.0.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collections/user/editProfile.d.ts +1 -1
- package/dist/collections/user/index.d.ts +1 -1
- package/dist/collections/user/index.js +14 -0
- package/dist/collections/user/index.mjs +14 -0
- package/dist/collections/user/redefinePassword.js +0 -5
- package/dist/collections/user/redefinePassword.mjs +7 -10
- package/dist/index.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { description } from './description.js';
|
|
2
2
|
import { type Context, type SchemaWithId, type PackReferences } from '@aeriajs/types';
|
|
3
|
-
export declare const editProfile: (payload: Partial<PackReferences<SchemaWithId<typeof description
|
|
3
|
+
export declare const editProfile: (payload: Partial<PackReferences<SchemaWithId<typeof description>>>, context: Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<SchemaWithId<{
|
|
4
4
|
readonly $id: "user";
|
|
5
5
|
readonly icon: "users";
|
|
6
6
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -374,7 +374,7 @@ export declare const user: Omit<Collection<never>, "functions" | "description" |
|
|
|
374
374
|
};
|
|
375
375
|
};
|
|
376
376
|
};
|
|
377
|
-
}
|
|
377
|
+
}>>>, context: Omit<Context, "token">) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
378
378
|
readonly $id: "user";
|
|
379
379
|
readonly icon: "users";
|
|
380
380
|
readonly required: readonly ["name", "roles", "email"];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.user = void 0;
|
|
4
4
|
const core_1 = require("@aeriajs/core");
|
|
5
|
+
const types_1 = require("@aeriajs/types");
|
|
5
6
|
const description_js_1 = require("./description.js");
|
|
6
7
|
const authenticate_js_1 = require("./authenticate.js");
|
|
7
8
|
const activate_js_1 = require("./activate.js");
|
|
@@ -60,6 +61,19 @@ exports.user = (0, core_1.defineCollection)({
|
|
|
60
61
|
Object.assign(exports.user, {
|
|
61
62
|
exposedFunctions,
|
|
62
63
|
contracts: {
|
|
64
|
+
editProfile: {
|
|
65
|
+
payload: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
required: [],
|
|
68
|
+
properties: description_js_1.description.properties,
|
|
69
|
+
},
|
|
70
|
+
response: [
|
|
71
|
+
types_1.functionSchemas.insertError(),
|
|
72
|
+
{
|
|
73
|
+
$ref: 'user',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
63
77
|
getCurrentUser: {
|
|
64
78
|
response: {
|
|
65
79
|
$ref: 'user',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { defineCollection, get, getAll, remove, upload, removeFile } from "@aeriajs/core";
|
|
3
|
+
import { functionSchemas } from "@aeriajs/types";
|
|
3
4
|
import { description } from "./description.mjs";
|
|
4
5
|
import { authenticate } from "./authenticate.mjs";
|
|
5
6
|
import { activate } from "./activate.mjs";
|
|
@@ -58,6 +59,19 @@ export const user = defineCollection({
|
|
|
58
59
|
Object.assign(user, {
|
|
59
60
|
exposedFunctions,
|
|
60
61
|
contracts: {
|
|
62
|
+
editProfile: {
|
|
63
|
+
payload: {
|
|
64
|
+
type: "object",
|
|
65
|
+
required: [],
|
|
66
|
+
properties: description.properties
|
|
67
|
+
},
|
|
68
|
+
response: [
|
|
69
|
+
functionSchemas.insertError(),
|
|
70
|
+
{
|
|
71
|
+
$ref: "user"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
61
75
|
getCurrentUser: {
|
|
62
76
|
response: {
|
|
63
77
|
$ref: "user"
|
|
@@ -45,11 +45,6 @@ const redefinePassword = async (payload, context) => {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
if (!password) {
|
|
48
|
-
/* if( context.request.method === 'GET' ) {
|
|
49
|
-
return context.response.writeHead(302, {
|
|
50
|
-
location: `/user/activation?step=password&u=${userId}&t=${token}`,
|
|
51
|
-
}).end()
|
|
52
|
-
} */
|
|
53
48
|
return context.error(types_1.HTTPStatus.UnprocessableContent, {
|
|
54
49
|
code: types_1.ACError.MalformedInput,
|
|
55
50
|
});
|
|
@@ -51,17 +51,14 @@ export const redefinePassword = async (payload, context) => {
|
|
|
51
51
|
code: ACError.MalformedInput
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
await context.collection.model.updateOne(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
active: true,
|
|
61
|
-
password: await bcrypt.hash(password, 10)
|
|
62
|
-
}
|
|
54
|
+
await context.collection.model.updateOne({
|
|
55
|
+
_id: user._id
|
|
56
|
+
}, {
|
|
57
|
+
$set: {
|
|
58
|
+
active: true,
|
|
59
|
+
password: await bcrypt.hash(password, 10)
|
|
63
60
|
}
|
|
64
|
-
);
|
|
61
|
+
});
|
|
65
62
|
return Result.result({
|
|
66
63
|
userId: user._id
|
|
67
64
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -838,7 +838,7 @@ export declare const collections: {
|
|
|
838
838
|
};
|
|
839
839
|
};
|
|
840
840
|
};
|
|
841
|
-
}
|
|
841
|
+
}>>>, context: Omit<import("@aeriajs/types").Context, "token">) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
|
|
842
842
|
readonly $id: "user";
|
|
843
843
|
readonly icon: "users";
|
|
844
844
|
readonly required: readonly ["name", "roles", "email"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/builtins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.235",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"mongodb": "^6.5.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@aeriajs/core": "^0.0.
|
|
49
|
-
"@aeriajs/common": "^0.0.
|
|
50
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
51
|
-
"@aeriajs/types": "^0.0.
|
|
52
|
-
"@aeriajs/validation": "^0.0.
|
|
48
|
+
"@aeriajs/core": "^0.0.235",
|
|
49
|
+
"@aeriajs/common": "^0.0.133",
|
|
50
|
+
"@aeriajs/entrypoint": "^0.0.137",
|
|
51
|
+
"@aeriajs/types": "^0.0.115",
|
|
52
|
+
"@aeriajs/validation": "^0.0.149"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "echo skipping",
|