@skroz/profile-api 1.0.22 → 1.0.25
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/entities/TypeOrmBaseEntity.d.ts +6 -0
- package/dist/entities/TypeOrmBaseEntity.js +41 -0
- package/dist/entities/TypeOrmBaseUser.d.ts +2 -5
- package/dist/entities/TypeOrmBaseUser.js +2 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
- package/src/entities/TypeOrmBaseEntity.ts +28 -0
- package/src/entities/TypeOrmBaseUser.ts +4 -21
- package/src/index.ts +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TypeOrmBaseEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const type_graphql_1 = require("type-graphql");
|
|
15
|
+
let TypeOrmBaseEntity = class TypeOrmBaseEntity extends typeorm_1.BaseEntity {
|
|
16
|
+
};
|
|
17
|
+
exports.TypeOrmBaseEntity = TypeOrmBaseEntity;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, type_graphql_1.Field)(() => type_graphql_1.ID, {
|
|
20
|
+
description: JSON.stringify({ en: 'The object ID.', ru: 'ID объекта.' }),
|
|
21
|
+
}),
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], TypeOrmBaseEntity.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, type_graphql_1.Field)({
|
|
27
|
+
description: JSON.stringify({ en: 'The date the object was created.', ru: 'Дата создания объекта.' }),
|
|
28
|
+
}),
|
|
29
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
30
|
+
__metadata("design:type", Date)
|
|
31
|
+
], TypeOrmBaseEntity.prototype, "createdAt", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, type_graphql_1.Field)({
|
|
34
|
+
description: JSON.stringify({ en: 'The date of the last update of the object.', ru: 'Дата последнего обновления объекта.' }),
|
|
35
|
+
}),
|
|
36
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
|
|
37
|
+
__metadata("design:type", Date)
|
|
38
|
+
], TypeOrmBaseEntity.prototype, "updatedAt", void 0);
|
|
39
|
+
exports.TypeOrmBaseEntity = TypeOrmBaseEntity = __decorate([
|
|
40
|
+
(0, type_graphql_1.ObjectType)({ isAbstract: true })
|
|
41
|
+
], TypeOrmBaseEntity);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare abstract class TypeOrmBaseUser extends
|
|
1
|
+
import { TypeOrmBaseEntity } from './TypeOrmBaseEntity';
|
|
2
|
+
export declare abstract class TypeOrmBaseUser extends TypeOrmBaseEntity {
|
|
3
3
|
static config: {
|
|
4
4
|
isOnlineSeconds: number;
|
|
5
5
|
isOnlineRecentlySeconds: number;
|
|
6
6
|
};
|
|
7
|
-
id: number;
|
|
8
|
-
createdAt: Date;
|
|
9
|
-
updatedAt: Date;
|
|
10
7
|
email: string | null;
|
|
11
8
|
password: string;
|
|
12
9
|
isTempPassword: boolean;
|
|
@@ -13,7 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.TypeOrmBaseUser = void 0;
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
15
|
const type_graphql_1 = require("type-graphql");
|
|
16
|
-
|
|
16
|
+
const TypeOrmBaseEntity_1 = require("./TypeOrmBaseEntity");
|
|
17
|
+
let TypeOrmBaseUser = TypeOrmBaseUser_1 = class TypeOrmBaseUser extends TypeOrmBaseEntity_1.TypeOrmBaseEntity {
|
|
17
18
|
checkOnline(seconds) {
|
|
18
19
|
if (!this.lastSeenAt)
|
|
19
20
|
return false;
|
|
@@ -33,21 +34,6 @@ TypeOrmBaseUser.config = {
|
|
|
33
34
|
isOnlineSeconds: 60,
|
|
34
35
|
isOnlineRecentlySeconds: 300,
|
|
35
36
|
};
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, type_graphql_1.Field)(() => type_graphql_1.ID),
|
|
38
|
-
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
39
|
-
__metadata("design:type", Number)
|
|
40
|
-
], TypeOrmBaseUser.prototype, "id", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, type_graphql_1.Field)(() => type_graphql_1.GraphQLTimestamp),
|
|
43
|
-
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
44
|
-
__metadata("design:type", Date)
|
|
45
|
-
], TypeOrmBaseUser.prototype, "createdAt", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, type_graphql_1.Field)(() => type_graphql_1.GraphQLTimestamp),
|
|
48
|
-
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
|
|
49
|
-
__metadata("design:type", Date)
|
|
50
|
-
], TypeOrmBaseUser.prototype, "updatedAt", void 0);
|
|
51
37
|
__decorate([
|
|
52
38
|
(0, typeorm_1.Column)({ type: 'varchar', nullable: true, unique: true }),
|
|
53
39
|
__metadata("design:type", Object)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
__exportStar(require("./adapters/TypeOrmProfileAdapter"), exports);
|
|
19
|
+
__exportStar(require("./entities/TypeOrmBaseEntity"), exports);
|
|
19
20
|
__exportStar(require("./entities/TypeOrmBaseUser"), exports);
|
|
20
21
|
__exportStar(require("./services/ProfileAuthService"), exports);
|
|
21
22
|
__exportStar(require("./services/ProfileEmailService"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skroz/profile-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "git@gitlab.com:skroz/libs/utils.git",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"type-graphql": "^1.1.1",
|
|
45
45
|
"typeorm": "^0.2.45"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "790f253b5f0449e881f5eecc40c06a9ae5aebcad"
|
|
48
48
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity as TypeORMBaseEntity,
|
|
3
|
+
CreateDateColumn,
|
|
4
|
+
PrimaryGeneratedColumn,
|
|
5
|
+
UpdateDateColumn,
|
|
6
|
+
} from 'typeorm';
|
|
7
|
+
import { Field, ID, ObjectType } from 'type-graphql';
|
|
8
|
+
|
|
9
|
+
@ObjectType({ isAbstract: true })
|
|
10
|
+
export abstract class TypeOrmBaseEntity extends TypeORMBaseEntity {
|
|
11
|
+
@Field(() => ID, {
|
|
12
|
+
description: JSON.stringify({ en: 'The object ID.', ru: 'ID объекта.' }),
|
|
13
|
+
})
|
|
14
|
+
@PrimaryGeneratedColumn()
|
|
15
|
+
public id!: number;
|
|
16
|
+
|
|
17
|
+
@Field({
|
|
18
|
+
description: JSON.stringify({ en: 'The date the object was created.', ru: 'Дата создания объекта.' }),
|
|
19
|
+
})
|
|
20
|
+
@CreateDateColumn({ type: 'timestamptz' })
|
|
21
|
+
public createdAt!: Date;
|
|
22
|
+
|
|
23
|
+
@Field({
|
|
24
|
+
description: JSON.stringify({ en: 'The date of the last update of the object.', ru: 'Дата последнего обновления объекта.' }),
|
|
25
|
+
})
|
|
26
|
+
@UpdateDateColumn({ type: 'timestamptz' })
|
|
27
|
+
public updatedAt!: Date;
|
|
28
|
+
}
|
|
@@ -1,31 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
PrimaryGeneratedColumn,
|
|
5
|
-
UpdateDateColumn,
|
|
6
|
-
BaseEntity as TypeORMBaseEntity,
|
|
7
|
-
} from 'typeorm';
|
|
8
|
-
import { Field, ID, ObjectType, GraphQLTimestamp } from 'type-graphql';
|
|
1
|
+
import { Column } from 'typeorm';
|
|
2
|
+
import { Field, ObjectType, GraphQLTimestamp } from 'type-graphql';
|
|
3
|
+
import { TypeOrmBaseEntity } from './TypeOrmBaseEntity';
|
|
9
4
|
|
|
10
5
|
@ObjectType({ isAbstract: true })
|
|
11
|
-
export abstract class TypeOrmBaseUser extends
|
|
6
|
+
export abstract class TypeOrmBaseUser extends TypeOrmBaseEntity {
|
|
12
7
|
public static config = {
|
|
13
8
|
isOnlineSeconds: 60,
|
|
14
9
|
isOnlineRecentlySeconds: 300,
|
|
15
10
|
};
|
|
16
11
|
|
|
17
|
-
@Field(() => ID)
|
|
18
|
-
@PrimaryGeneratedColumn()
|
|
19
|
-
public id!: number;
|
|
20
|
-
|
|
21
|
-
@Field(() => GraphQLTimestamp)
|
|
22
|
-
@CreateDateColumn({ type: 'timestamptz' })
|
|
23
|
-
public createdAt!: Date;
|
|
24
|
-
|
|
25
|
-
@Field(() => GraphQLTimestamp)
|
|
26
|
-
@UpdateDateColumn({ type: 'timestamptz' })
|
|
27
|
-
public updatedAt!: Date;
|
|
28
|
-
|
|
29
12
|
@Column({ type: 'varchar', nullable: true, unique: true })
|
|
30
13
|
public email!: string | null;
|
|
31
14
|
|
package/src/index.ts
CHANGED