@social.dev/server-sdk 0.0.1-alpha.1
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/README.md +73 -0
- package/dist/app.module.d.ts +10 -0
- package/dist/app.module.js +96 -0
- package/dist/app.module.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +6 -0
- package/dist/auth/auth.controller.js +43 -0
- package/dist/auth/auth.controller.js.map +1 -0
- package/dist/auth/auth.guard.d.ts +7 -0
- package/dist/auth/auth.guard.js +33 -0
- package/dist/auth/auth.guard.js.map +1 -0
- package/dist/auth/auth.middleware.d.ts +14 -0
- package/dist/auth/auth.middleware.js +60 -0
- package/dist/auth/auth.middleware.js.map +1 -0
- package/dist/auth/auth.module.d.ts +2 -0
- package/dist/auth/auth.module.js +35 -0
- package/dist/auth/auth.module.js.map +1 -0
- package/dist/auth/auth.service.d.ts +11 -0
- package/dist/auth/auth.service.js +41 -0
- package/dist/auth/auth.service.js.map +1 -0
- package/dist/auth/constants.d.ts +3 -0
- package/dist/auth/constants.js +7 -0
- package/dist/auth/constants.js.map +1 -0
- package/dist/auth/dto/login-success.dto.d.ts +5 -0
- package/dist/auth/dto/login-success.dto.js +40 -0
- package/dist/auth/dto/login-success.dto.js.map +1 -0
- package/dist/auth/dto/login.dto.d.ts +4 -0
- package/dist/auth/dto/login.dto.js +31 -0
- package/dist/auth/dto/login.dto.js.map +1 -0
- package/dist/auth/enums/auth-method.enum.d.ts +4 -0
- package/dist/auth/enums/auth-method.enum.js +9 -0
- package/dist/auth/enums/auth-method.enum.js.map +1 -0
- package/dist/auth/enums/auth-methods.enum.d.ts +2 -0
- package/dist/auth/enums/auth-methods.enum.js +7 -0
- package/dist/auth/enums/auth-methods.enum.js.map +1 -0
- package/dist/auth/oidc/dto/responses.d.ts +5 -0
- package/dist/auth/oidc/dto/responses.js +45 -0
- package/dist/auth/oidc/dto/responses.js.map +1 -0
- package/dist/auth/oidc/entities/oidc-user.entity.d.ts +8 -0
- package/dist/auth/oidc/entities/oidc-user.entity.js +47 -0
- package/dist/auth/oidc/entities/oidc-user.entity.js.map +1 -0
- package/dist/auth/oidc/oidc.controller.d.ts +12 -0
- package/dist/auth/oidc/oidc.controller.js +91 -0
- package/dist/auth/oidc/oidc.controller.js.map +1 -0
- package/dist/auth/oidc/oidc.module.d.ts +2 -0
- package/dist/auth/oidc/oidc.module.js +33 -0
- package/dist/auth/oidc/oidc.module.js.map +1 -0
- package/dist/auth/oidc/oidc.service.d.ts +32 -0
- package/dist/auth/oidc/oidc.service.js +181 -0
- package/dist/auth/oidc/oidc.service.js.map +1 -0
- package/dist/auth/session/auth.controller.d.ts +10 -0
- package/dist/auth/session/auth.controller.js +92 -0
- package/dist/auth/session/auth.controller.js.map +1 -0
- package/dist/auth/session/auth.service.d.ts +12 -0
- package/dist/auth/session/auth.service.js +46 -0
- package/dist/auth/session/auth.service.js.map +1 -0
- package/dist/auth/session/session.controller.d.ts +9 -0
- package/dist/auth/session/session.controller.js +84 -0
- package/dist/auth/session/session.controller.js.map +1 -0
- package/dist/auth/session/session.module.d.ts +2 -0
- package/dist/auth/session/session.module.js +25 -0
- package/dist/auth/session/session.module.js.map +1 -0
- package/dist/auth/session/session.service.d.ts +18 -0
- package/dist/auth/session/session.service.js +62 -0
- package/dist/auth/session/session.service.js.map +1 -0
- package/dist/bootstrap.d.ts +1 -0
- package/dist/bootstrap.js +32 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/chat/chat.controller.d.ts +18 -0
- package/dist/chat/chat.controller.js +133 -0
- package/dist/chat/chat.controller.js.map +1 -0
- package/dist/chat/chat.module.d.ts +2 -0
- package/dist/chat/chat.module.js +34 -0
- package/dist/chat/chat.module.js.map +1 -0
- package/dist/chat/chat.service.d.ts +30 -0
- package/dist/chat/chat.service.js +113 -0
- package/dist/chat/chat.service.js.map +1 -0
- package/dist/chat/dto/create-conversation.dto.d.ts +10 -0
- package/dist/chat/dto/create-conversation.dto.js +43 -0
- package/dist/chat/dto/create-conversation.dto.js.map +1 -0
- package/dist/chat/dto/create-message.dto.d.ts +5 -0
- package/dist/chat/dto/create-message.dto.js +31 -0
- package/dist/chat/dto/create-message.dto.js.map +1 -0
- package/dist/chat/dto/index.d.ts +4 -0
- package/dist/chat/dto/index.js +24 -0
- package/dist/chat/dto/index.js.map +1 -0
- package/dist/chat/dto/responses.dto.d.ts +14 -0
- package/dist/chat/dto/responses.dto.js +64 -0
- package/dist/chat/dto/responses.dto.js.map +1 -0
- package/dist/chat/entities/conversation-member.entity.d.ts +9 -0
- package/dist/chat/entities/conversation-member.entity.js +59 -0
- package/dist/chat/entities/conversation-member.entity.js.map +1 -0
- package/dist/chat/entities/conversation.entity.d.ts +9 -0
- package/dist/chat/entities/conversation.entity.js +56 -0
- package/dist/chat/entities/conversation.entity.js.map +1 -0
- package/dist/chat/entities/message.entity.d.ts +9 -0
- package/dist/chat/entities/message.entity.js +51 -0
- package/dist/chat/entities/message.entity.js.map +1 -0
- package/dist/chat/enums/conversation-type.enum.d.ts +3 -0
- package/dist/chat/enums/conversation-type.enum.js +8 -0
- package/dist/chat/enums/conversation-type.enum.js.map +1 -0
- package/dist/common/decorators/api-paginated-response.d.ts +2 -0
- package/dist/common/decorators/api-paginated-response.js +26 -0
- package/dist/common/decorators/api-paginated-response.js.map +1 -0
- package/dist/common/dto/paginated-response.dto.d.ts +4 -0
- package/dist/common/dto/paginated-response.dto.js +34 -0
- package/dist/common/dto/paginated-response.dto.js.map +1 -0
- package/dist/common/entities/base.repository.d.ts +7 -0
- package/dist/common/entities/base.repository.js +32 -0
- package/dist/common/entities/base.repository.js.map +1 -0
- package/dist/common/utils/ffmpeg.d.ts +1 -0
- package/dist/common/utils/ffmpeg.js +32 -0
- package/dist/common/utils/ffmpeg.js.map +1 -0
- package/dist/common/utils/ffprobe.d.ts +1 -0
- package/dist/common/utils/ffprobe.js +34 -0
- package/dist/common/utils/ffprobe.js.map +1 -0
- package/dist/common/utils/fs.d.ts +1 -0
- package/dist/common/utils/fs.js +12 -0
- package/dist/common/utils/fs.js.map +1 -0
- package/dist/common/utils/math.d.ts +1 -0
- package/dist/common/utils/math.js +8 -0
- package/dist/common/utils/math.js.map +1 -0
- package/dist/community/community.acl.d.ts +3 -0
- package/dist/community/community.acl.js +49 -0
- package/dist/community/community.acl.js.map +1 -0
- package/dist/community/community.controller.d.ts +25 -0
- package/dist/community/community.controller.js +273 -0
- package/dist/community/community.controller.js.map +1 -0
- package/dist/community/community.module.d.ts +2 -0
- package/dist/community/community.module.js +39 -0
- package/dist/community/community.module.js.map +1 -0
- package/dist/community/community.service.d.ts +37 -0
- package/dist/community/community.service.js +200 -0
- package/dist/community/community.service.js.map +1 -0
- package/dist/community/dto/community-members-response.dto.d.ts +5 -0
- package/dist/community/dto/community-members-response.dto.js +29 -0
- package/dist/community/dto/community-members-response.dto.js.map +1 -0
- package/dist/community/dto/community-response.dto.d.ts +14 -0
- package/dist/community/dto/community-response.dto.js +88 -0
- package/dist/community/dto/community-response.dto.js.map +1 -0
- package/dist/community/dto/create-community.dto.d.ts +3 -0
- package/dist/community/dto/create-community.dto.js +26 -0
- package/dist/community/dto/create-community.dto.js.map +1 -0
- package/dist/community/dto/index.d.ts +10 -0
- package/dist/community/dto/index.js +33 -0
- package/dist/community/dto/index.js.map +1 -0
- package/dist/community/dto/update-community.dto.d.ts +5 -0
- package/dist/community/dto/update-community.dto.js +13 -0
- package/dist/community/dto/update-community.dto.js.map +1 -0
- package/dist/community/entities/community-member.entity.d.ts +13 -0
- package/dist/community/entities/community-member.entity.js +74 -0
- package/dist/community/entities/community-member.entity.js.map +1 -0
- package/dist/community/entities/community.entity.d.ts +10 -0
- package/dist/community/entities/community.entity.js +61 -0
- package/dist/community/entities/community.entity.js.map +1 -0
- package/dist/community/enums/community-privacy.enum.d.ts +6 -0
- package/dist/community/enums/community-privacy.enum.js +11 -0
- package/dist/community/enums/community-privacy.enum.js.map +1 -0
- package/dist/community/enums/community-role.enum.d.ts +7 -0
- package/dist/community/enums/community-role.enum.js +12 -0
- package/dist/community/enums/community-role.enum.js.map +1 -0
- package/dist/community/enums/community-status.enum.d.ts +7 -0
- package/dist/community/enums/community-status.enum.js +12 -0
- package/dist/community/enums/community-status.enum.js.map +1 -0
- package/dist/configs/configs.controller.d.ts +4 -0
- package/dist/configs/configs.controller.js +40 -0
- package/dist/configs/configs.controller.js.map +1 -0
- package/dist/configs/configs.module.d.ts +2 -0
- package/dist/configs/configs.module.js +20 -0
- package/dist/configs/configs.module.js.map +1 -0
- package/dist/configs/configs.service.d.ts +2 -0
- package/dist/configs/configs.service.js +17 -0
- package/dist/configs/configs.service.js.map +1 -0
- package/dist/configs/dto/public-config.dto.d.ts +6 -0
- package/dist/configs/dto/public-config.dto.js +43 -0
- package/dist/configs/dto/public-config.dto.js.map +1 -0
- package/dist/core/acl/acl.factory.d.ts +23 -0
- package/dist/core/acl/acl.factory.js +42 -0
- package/dist/core/acl/acl.factory.js.map +1 -0
- package/dist/core/acl/acl.module.d.ts +6 -0
- package/dist/core/acl/acl.module.js +36 -0
- package/dist/core/acl/acl.module.js.map +1 -0
- package/dist/core/context/context.d.ts +11 -0
- package/dist/core/context/context.js +23 -0
- package/dist/core/context/context.js.map +1 -0
- package/dist/core/context/context.module.d.ts +2 -0
- package/dist/core/context/context.module.js +33 -0
- package/dist/core/context/context.module.js.map +1 -0
- package/dist/core/context/context.service.d.ts +4 -0
- package/dist/core/context/context.service.js +8 -0
- package/dist/core/context/context.service.js.map +1 -0
- package/dist/core/context/context.store.d.ts +7 -0
- package/dist/core/context/context.store.js +3 -0
- package/dist/core/context/context.store.js.map +1 -0
- package/dist/core/core.module.d.ts +2 -0
- package/dist/core/core.module.js +21 -0
- package/dist/core/core.module.js.map +1 -0
- package/dist/core/plugin/plugin-hook.service.d.ts +7 -0
- package/dist/core/plugin/plugin-hook.service.js +43 -0
- package/dist/core/plugin/plugin-hook.service.js.map +1 -0
- package/dist/core/plugin/plugin.factory.d.ts +5 -0
- package/dist/core/plugin/plugin.factory.js +14 -0
- package/dist/core/plugin/plugin.factory.js.map +1 -0
- package/dist/core/plugin/plugin.module.d.ts +4 -0
- package/dist/core/plugin/plugin.module.js +33 -0
- package/dist/core/plugin/plugin.module.js.map +1 -0
- package/dist/file-storage/file-storage.module.d.ts +2 -0
- package/dist/file-storage/file-storage.module.js +21 -0
- package/dist/file-storage/file-storage.module.js.map +1 -0
- package/dist/file-storage/file-storage.service.d.ts +8 -0
- package/dist/file-storage/file-storage.service.js +50 -0
- package/dist/file-storage/file-storage.service.js.map +1 -0
- package/dist/file-storage/utils.d.ts +2 -0
- package/dist/file-storage/utils.js +8 -0
- package/dist/file-storage/utils.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/media/dto/media-response.dto.d.ts +7 -0
- package/dist/media/dto/media-response.dto.js +57 -0
- package/dist/media/dto/media-response.dto.js.map +1 -0
- package/dist/media/entities/audio.entity.d.ts +4 -0
- package/dist/media/entities/audio.entity.js +30 -0
- package/dist/media/entities/audio.entity.js.map +1 -0
- package/dist/media/entities/media.entity.d.ts +10 -0
- package/dist/media/entities/media.entity.js +57 -0
- package/dist/media/entities/media.entity.js.map +1 -0
- package/dist/media/entities/post-media.entity.d.ts +5 -0
- package/dist/media/entities/post-media.entity.js +31 -0
- package/dist/media/entities/post-media.entity.js.map +1 -0
- package/dist/media/media.acl.d.ts +5 -0
- package/dist/media/media.acl.js +11 -0
- package/dist/media/media.acl.js.map +1 -0
- package/dist/media/media.controller.d.ts +9 -0
- package/dist/media/media.controller.js +95 -0
- package/dist/media/media.controller.js.map +1 -0
- package/dist/media/media.module.d.ts +2 -0
- package/dist/media/media.module.js +39 -0
- package/dist/media/media.module.js.map +1 -0
- package/dist/media/media.service.d.ts +18 -0
- package/dist/media/media.service.js +131 -0
- package/dist/media/media.service.js.map +1 -0
- package/dist/network/dto/create-network.dto.d.ts +2 -0
- package/dist/network/dto/create-network.dto.js +11 -0
- package/dist/network/dto/create-network.dto.js.map +1 -0
- package/dist/network/dto/update-network.dto.d.ts +5 -0
- package/dist/network/dto/update-network.dto.js +13 -0
- package/dist/network/dto/update-network.dto.js.map +1 -0
- package/dist/network/entities/network.entity.d.ts +6 -0
- package/dist/network/entities/network.entity.js +42 -0
- package/dist/network/entities/network.entity.js.map +1 -0
- package/dist/network/network.middleware.d.ts +10 -0
- package/dist/network/network.middleware.js +39 -0
- package/dist/network/network.middleware.js.map +1 -0
- package/dist/network/network.module.d.ts +2 -0
- package/dist/network/network.module.js +24 -0
- package/dist/network/network.module.js.map +1 -0
- package/dist/network/network.service.d.ts +14 -0
- package/dist/network/network.service.js +50 -0
- package/dist/network/network.service.js.map +1 -0
- package/dist/post/dto/create-post.dto.d.ts +7 -0
- package/dist/post/dto/create-post.dto.js +49 -0
- package/dist/post/dto/create-post.dto.js.map +1 -0
- package/dist/post/dto/post-response.dto.d.ts +14 -0
- package/dist/post/dto/post-response.dto.js +85 -0
- package/dist/post/dto/post-response.dto.js.map +1 -0
- package/dist/post/dto/update-post.dto.d.ts +5 -0
- package/dist/post/dto/update-post.dto.js +13 -0
- package/dist/post/dto/update-post.dto.js.map +1 -0
- package/dist/post/entities/post.entity.d.ts +18 -0
- package/dist/post/entities/post.entity.js +86 -0
- package/dist/post/entities/post.entity.js.map +1 -0
- package/dist/post/post.acl.d.ts +3 -0
- package/dist/post/post.acl.js +20 -0
- package/dist/post/post.acl.js.map +1 -0
- package/dist/post/post.controller.d.ts +14 -0
- package/dist/post/post.controller.js +134 -0
- package/dist/post/post.controller.js.map +1 -0
- package/dist/post/post.module.d.ts +2 -0
- package/dist/post/post.module.js +40 -0
- package/dist/post/post.module.js.map +1 -0
- package/dist/post/post.service.d.ts +23 -0
- package/dist/post/post.service.js +172 -0
- package/dist/post/post.service.js.map +1 -0
- package/dist/post/reaction/dto/index.d.ts +3 -0
- package/dist/post/reaction/dto/index.js +22 -0
- package/dist/post/reaction/dto/index.js.map +1 -0
- package/dist/post/reaction/entities/reaction.entity.d.ts +9 -0
- package/dist/post/reaction/entities/reaction.entity.js +51 -0
- package/dist/post/reaction/entities/reaction.entity.js.map +1 -0
- package/dist/post/reaction/reaction.controller.d.ts +8 -0
- package/dist/post/reaction/reaction.controller.js +63 -0
- package/dist/post/reaction/reaction.controller.js.map +1 -0
- package/dist/post/reaction/reaction.module.d.ts +2 -0
- package/dist/post/reaction/reaction.module.js +25 -0
- package/dist/post/reaction/reaction.module.js.map +1 -0
- package/dist/post/reaction/reaction.service.d.ts +13 -0
- package/dist/post/reaction/reaction.service.js +48 -0
- package/dist/post/reaction/reaction.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/user/dto/create-user.dto.d.ts +2 -0
- package/dist/user/dto/create-user.dto.js +11 -0
- package/dist/user/dto/create-user.dto.js.map +1 -0
- package/dist/user/dto/update-user.dto.d.ts +5 -0
- package/dist/user/dto/update-user.dto.js +13 -0
- package/dist/user/dto/update-user.dto.js.map +1 -0
- package/dist/user/dto/user-response.dto.d.ts +5 -0
- package/dist/user/dto/user-response.dto.js +40 -0
- package/dist/user/dto/user-response.dto.js.map +1 -0
- package/dist/user/entities/user.entity.d.ts +11 -0
- package/dist/user/entities/user.entity.js +65 -0
- package/dist/user/entities/user.entity.js.map +1 -0
- package/dist/user/user.acl.d.ts +3 -0
- package/dist/user/user.acl.js +9 -0
- package/dist/user/user.acl.js.map +1 -0
- package/dist/user/user.controller.d.ts +7 -0
- package/dist/user/user.controller.js +60 -0
- package/dist/user/user.controller.js.map +1 -0
- package/dist/user/user.exceptions.d.ts +5 -0
- package/dist/user/user.exceptions.js +11 -0
- package/dist/user/user.exceptions.js.map +1 -0
- package/dist/user/user.module.d.ts +2 -0
- package/dist/user/user.module.js +36 -0
- package/dist/user/user.module.js.map +1 -0
- package/dist/user/user.service.d.ts +22 -0
- package/dist/user/user.service.js +90 -0
- package/dist/user/user.service.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateUserDto = void 0;
|
|
4
|
+
const openapi = require("@nestjs/swagger");
|
|
5
|
+
class CreateUserDto {
|
|
6
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.CreateUserDto = CreateUserDto;
|
|
11
|
+
//# sourceMappingURL=create-user.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-user.dto.js","sourceRoot":"","sources":["../../../src/user/dto/create-user.dto.ts"],"names":[],"mappings":";;;;AAAA,MAAa,aAAa;;;;CAAG;AAA7B,sCAA6B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateUserDto = void 0;
|
|
4
|
+
const openapi = require("@nestjs/swagger");
|
|
5
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
6
|
+
const create_user_dto_1 = require("./create-user.dto");
|
|
7
|
+
class UpdateUserDto extends (0, swagger_1.PartialType)(create_user_dto_1.CreateUserDto) {
|
|
8
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.UpdateUserDto = UpdateUserDto;
|
|
13
|
+
//# sourceMappingURL=update-user.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-user.dto.js","sourceRoot":"","sources":["../../../src/user/dto/update-user.dto.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAC9C,uDAAkD;AAElD,MAAa,aAAc,SAAQ,IAAA,qBAAW,EAAC,+BAAa,CAAC;;;;CAAG;AAAhE,sCAAgE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.UserResponseDto = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
class UserResponseDto {
|
|
17
|
+
id;
|
|
18
|
+
username;
|
|
19
|
+
name;
|
|
20
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
21
|
+
return { id: { required: true, type: () => Number }, username: { required: true, type: () => String }, name: { required: true, type: () => String } };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.UserResponseDto = UserResponseDto;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ description: 'The unique identifier of the user' }),
|
|
27
|
+
(0, class_transformer_1.Expose)(),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], UserResponseDto.prototype, "id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, swagger_1.ApiProperty)({ description: 'The handle/alias of the user' }),
|
|
32
|
+
(0, class_transformer_1.Expose)(),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], UserResponseDto.prototype, "username", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({ description: 'The display name of the user (non-unique)' }),
|
|
37
|
+
(0, class_transformer_1.Expose)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], UserResponseDto.prototype, "name", void 0);
|
|
40
|
+
//# sourceMappingURL=user-response.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-response.dto.js","sourceRoot":"","sources":["../../../src/user/dto/user-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,yDAA2C;AAE3C,MAAa,eAAe;IAG1B,EAAE,CAAS;IAIX,QAAQ,CAAS;IAIjB,IAAI,CAAS;;;;CACd;AAZD,0CAYC;AATC;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IACjE,IAAA,0BAAM,GAAE;;2CACE;AAIX;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC5D,IAAA,0BAAM,GAAE;;iDACQ;AAIjB;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IACzE,IAAA,0BAAM,GAAE;;6CACI"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Network } from '~/network/entities/network.entity';
|
|
2
|
+
import { CommunityMember } from '~/community/entities/community-member.entity';
|
|
3
|
+
export declare class User {
|
|
4
|
+
network: Network;
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
username: string;
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
communities: CommunityMember[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.User = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const network_entity_1 = require("../../network/entities/network.entity");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const class_transformer_1 = require("class-transformer");
|
|
17
|
+
const community_member_entity_1 = require("../../community/entities/community-member.entity");
|
|
18
|
+
let User = class User {
|
|
19
|
+
network;
|
|
20
|
+
id;
|
|
21
|
+
name;
|
|
22
|
+
username;
|
|
23
|
+
email;
|
|
24
|
+
password;
|
|
25
|
+
communities;
|
|
26
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
27
|
+
return { network: { required: true, type: () => require("../../network/entities/network.entity").Network }, id: { required: true, type: () => Number }, name: { required: true, type: () => String }, username: { required: true, type: () => String }, email: { required: true, type: () => String }, password: { required: true, type: () => String }, communities: { required: true, type: () => [require("../../community/entities/community-member.entity").CommunityMember] } };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.User = User;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.ManyToOne)(() => network_entity_1.Network, { onDelete: 'CASCADE' }),
|
|
33
|
+
__metadata("design:type", network_entity_1.Network)
|
|
34
|
+
], User.prototype, "network", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], User.prototype, "id", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 30 }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], User.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 15 }),
|
|
45
|
+
(0, typeorm_1.Unique)('username_unique', ['username', 'network']),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], User.prototype, "username", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 40 }),
|
|
50
|
+
(0, class_transformer_1.Exclude)(),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], User.prototype, "email", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
55
|
+
(0, class_transformer_1.Exclude)(),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], User.prototype, "password", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.OneToMany)(() => community_member_entity_1.CommunityMember, (sub) => sub.user, { onDelete: 'CASCADE' }),
|
|
60
|
+
__metadata("design:type", Array)
|
|
61
|
+
], User.prototype, "communities", void 0);
|
|
62
|
+
exports.User = User = __decorate([
|
|
63
|
+
(0, typeorm_1.Entity)()
|
|
64
|
+
], User);
|
|
65
|
+
//# sourceMappingURL=user.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../src/user/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0EAA4D;AAE5D,qCASiB;AACjB,yDAA4C;AAC5C,8FAA+E;AAGxE,IAAM,IAAI,GAAV,MAAM,IAAI;IAKf,OAAO,CAAU;IAMjB,EAAE,CAAS;IAGX,IAAI,CAAS;IAIb,QAAQ,CAAS;IAIjB,KAAK,CAAS;IAId,QAAQ,CAAS;IAMjB,WAAW,CAAoB;;;;CAChC,CAAA;AAjCY,oBAAI;AAKf;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;8BACzC,wBAAO;qCAAC;AAMjB;IADC,IAAA,gCAAsB,GAAE;;gCACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;kCAC3B;AAIb;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,gBAAM,EAAC,iBAAiB,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;;sCAClC;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,2BAAO,GAAE;;mCACI;AAId;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,2BAAO,GAAE;;sCACO;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAAe,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;;yCAC9C;eAhCpB,IAAI;IADhB,IAAA,gBAAM,GAAE;GACI,IAAI,CAiChB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const acl_factory_1 = require("../core/acl/acl.factory");
|
|
4
|
+
const user_entity_1 = require("./entities/user.entity");
|
|
5
|
+
const UserAclRules = [
|
|
6
|
+
({ can }) => can(acl_factory_1.Action.Read, user_entity_1.User, (user) => true),
|
|
7
|
+
];
|
|
8
|
+
exports.default = UserAclRules;
|
|
9
|
+
//# sourceMappingURL=user.acl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.acl.js","sourceRoot":"","sources":["../../src/user/user.acl.ts"],"names":[],"mappings":";;AAAA,yDAA8D;AAC9D,wDAA8C;AAE9C,MAAM,YAAY,GAAmB;IAEnC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,oBAAM,CAAC,IAAI,EAAE,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC;CACpD,CAAC;AACF,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UserService } from './user.service';
|
|
2
|
+
export declare class UserController {
|
|
3
|
+
private readonly userService;
|
|
4
|
+
constructor(userService: UserService);
|
|
5
|
+
findAll(): Promise<import("./entities/user.entity").User[]>;
|
|
6
|
+
findOne(id: string): Promise<import("./entities/user.entity").User | null>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UserController = void 0;
|
|
16
|
+
const openapi = require("@nestjs/swagger");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const user_service_1 = require("./user.service");
|
|
19
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
20
|
+
let UserController = class UserController {
|
|
21
|
+
userService;
|
|
22
|
+
constructor(userService) {
|
|
23
|
+
this.userService = userService;
|
|
24
|
+
}
|
|
25
|
+
findAll() {
|
|
26
|
+
return this.userService.findAll();
|
|
27
|
+
}
|
|
28
|
+
findOne(id) {
|
|
29
|
+
return this.userService.findOne(+id);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.UserController = UserController;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiOperation)({
|
|
35
|
+
summary: 'Lists users on the network',
|
|
36
|
+
description: 'Returns a list of user entities',
|
|
37
|
+
}),
|
|
38
|
+
(0, common_1.Get)('user.list'),
|
|
39
|
+
openapi.ApiResponse({ status: 200, type: [require("./entities/user.entity").User] }),
|
|
40
|
+
__metadata("design:type", Function),
|
|
41
|
+
__metadata("design:paramtypes", []),
|
|
42
|
+
__metadata("design:returntype", void 0)
|
|
43
|
+
], UserController.prototype, "findAll", null);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, swagger_1.ApiOperation)({
|
|
46
|
+
summary: 'Retrieve a user',
|
|
47
|
+
description: 'Returns a information about a user',
|
|
48
|
+
}),
|
|
49
|
+
(0, common_1.Get)('user.info'),
|
|
50
|
+
openapi.ApiResponse({ status: 200, type: Object }),
|
|
51
|
+
__param(0, (0, common_1.Query)('user')),
|
|
52
|
+
__metadata("design:type", Function),
|
|
53
|
+
__metadata("design:paramtypes", [String]),
|
|
54
|
+
__metadata("design:returntype", void 0)
|
|
55
|
+
], UserController.prototype, "findOne", null);
|
|
56
|
+
exports.UserController = UserController = __decorate([
|
|
57
|
+
(0, common_1.Controller)(),
|
|
58
|
+
__metadata("design:paramtypes", [user_service_1.UserService])
|
|
59
|
+
], UserController);
|
|
60
|
+
//# sourceMappingURL=user.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,iDAA6C;AAM7C,6CAA+C;AAGxC,IAAM,cAAc,GAApB,MAAM,cAAc;IACI;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAYzD,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACpC,CAAC;IAOD,OAAO,CAAgB,EAAU;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;CAWF,CAAA;AAnCY,wCAAc;AAazB;IALC,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,4BAA4B;QACrC,WAAW,EAAE,iCAAiC;KAC/C,CAAC;IACD,IAAA,YAAG,EAAC,WAAW,CAAC;;;;;6CAGhB;AAOD;IALC,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,oCAAoC;KAClD,CAAC;IACD,IAAA,YAAG,EAAC,WAAW,CAAC;;IACR,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;6CAErB;yBAxBU,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAE+B,0BAAW;GAD1C,cAAc,CAmC1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidUsernameException = exports.UsernameTakenException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class UsernameTakenException extends common_1.ConflictException {
|
|
6
|
+
}
|
|
7
|
+
exports.UsernameTakenException = UsernameTakenException;
|
|
8
|
+
class InvalidUsernameException extends common_1.NotAcceptableException {
|
|
9
|
+
}
|
|
10
|
+
exports.InvalidUsernameException = InvalidUsernameException;
|
|
11
|
+
//# sourceMappingURL=user.exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.exceptions.js","sourceRoot":"","sources":["../../src/user/user.exceptions.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AAExB,MAAa,sBAAuB,SAAQ,0BAAiB;CAAG;AAAhE,wDAAgE;AAEhE,MAAa,wBAAyB,SAAQ,+BAAsB;CAAG;AAAvE,4DAAuE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserModule = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const user_service_1 = require("./user.service");
|
|
15
|
+
const user_controller_1 = require("./user.controller");
|
|
16
|
+
const user_entity_1 = require("./entities/user.entity");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const post_module_1 = require("../post/post.module");
|
|
19
|
+
const acl_module_1 = require("../core/acl/acl.module");
|
|
20
|
+
const user_acl_1 = __importDefault(require("./user.acl"));
|
|
21
|
+
let UserModule = class UserModule {
|
|
22
|
+
};
|
|
23
|
+
exports.UserModule = UserModule;
|
|
24
|
+
exports.UserModule = UserModule = __decorate([
|
|
25
|
+
(0, common_1.Module)({
|
|
26
|
+
imports: [
|
|
27
|
+
typeorm_1.TypeOrmModule.forFeature([user_entity_1.User]),
|
|
28
|
+
(0, common_1.forwardRef)(() => post_module_1.PostModule),
|
|
29
|
+
acl_module_1.AclModule.forChild(user_acl_1.default),
|
|
30
|
+
],
|
|
31
|
+
controllers: [user_controller_1.UserController],
|
|
32
|
+
providers: [user_service_1.UserService],
|
|
33
|
+
exports: [user_service_1.UserService],
|
|
34
|
+
})
|
|
35
|
+
], UserModule);
|
|
36
|
+
//# sourceMappingURL=user.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.module.js","sourceRoot":"","sources":["../../src/user/user.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoD;AACpD,iDAA6C;AAC7C,uDAAmD;AACnD,wDAA8C;AAC9C,6CAAgD;AAChD,qDAAgD;AAChD,uDAAkD;AAClD,0DAAsC;AAY/B,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAVtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC,CAAC,kBAAI,CAAC,CAAC;YAChC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;YAC5B,sBAAS,CAAC,QAAQ,CAAC,kBAAY,CAAC;SACjC;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UpdateUserDto } from './dto/update-user.dto';
|
|
2
|
+
import { User } from './entities/user.entity';
|
|
3
|
+
import { QueryRunner, Repository } from 'typeorm';
|
|
4
|
+
import { DataSource } from 'typeorm';
|
|
5
|
+
export declare class UserService {
|
|
6
|
+
private readonly repository;
|
|
7
|
+
private readonly dataSource;
|
|
8
|
+
constructor(repository: Repository<User>, dataSource: DataSource);
|
|
9
|
+
create({ username, name, email, password, verified, }: {
|
|
10
|
+
username: string;
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
verified?: boolean;
|
|
15
|
+
}, queryRunner?: QueryRunner): Promise<User>;
|
|
16
|
+
verifyUsername(username: string, queryRunner?: QueryRunner): Promise<boolean>;
|
|
17
|
+
findAll(): Promise<User[]>;
|
|
18
|
+
findOne(id: number): Promise<User | null>;
|
|
19
|
+
findOneByUsername(username: string): Promise<User | null>;
|
|
20
|
+
update(id: number, updateUserDto: UpdateUserDto): string;
|
|
21
|
+
remove(id: number): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UserService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const user_entity_1 = require("./entities/user.entity");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const context_1 = require("../core/context/context");
|
|
21
|
+
const user_exceptions_1 = require("./user.exceptions");
|
|
22
|
+
const typeorm_3 = require("typeorm");
|
|
23
|
+
let UserService = class UserService {
|
|
24
|
+
repository;
|
|
25
|
+
dataSource;
|
|
26
|
+
constructor(repository, dataSource) {
|
|
27
|
+
this.repository = repository;
|
|
28
|
+
this.dataSource = dataSource;
|
|
29
|
+
}
|
|
30
|
+
async create({ username, name, email, password, verified = false, }, queryRunner) {
|
|
31
|
+
if (!queryRunner) {
|
|
32
|
+
queryRunner = this.dataSource.createQueryRunner();
|
|
33
|
+
}
|
|
34
|
+
this.verifyUsername(username, queryRunner);
|
|
35
|
+
let user = queryRunner.manager.create(user_entity_1.User, {
|
|
36
|
+
network: context_1.Context.getNetwork(),
|
|
37
|
+
username,
|
|
38
|
+
name,
|
|
39
|
+
email,
|
|
40
|
+
password,
|
|
41
|
+
});
|
|
42
|
+
return await queryRunner.manager.save(user);
|
|
43
|
+
}
|
|
44
|
+
async verifyUsername(username, queryRunner) {
|
|
45
|
+
if (!queryRunner) {
|
|
46
|
+
queryRunner = this.dataSource.createQueryRunner();
|
|
47
|
+
}
|
|
48
|
+
const usernameRegex = /^[a-zA-Z0-9_.]{4,15}$/;
|
|
49
|
+
if (!usernameRegex.test(username)) {
|
|
50
|
+
throw new user_exceptions_1.InvalidUsernameException('Username must be 4-15 characters long and contain only letters, numbers, underscores, and periods');
|
|
51
|
+
}
|
|
52
|
+
if (username.toLowerCase().includes('admin')) {
|
|
53
|
+
throw new user_exceptions_1.InvalidUsernameException('Username cannot contain the word "admin"');
|
|
54
|
+
}
|
|
55
|
+
const record = await queryRunner?.manager.findOneBy(user_entity_1.User, {
|
|
56
|
+
network: context_1.Context.getNetwork(),
|
|
57
|
+
username: username,
|
|
58
|
+
});
|
|
59
|
+
if (record) {
|
|
60
|
+
throw new user_exceptions_1.UsernameTakenException();
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
findAll() {
|
|
65
|
+
return this.repository.find();
|
|
66
|
+
}
|
|
67
|
+
findOne(id) {
|
|
68
|
+
return this.repository.findOne({
|
|
69
|
+
where: { id },
|
|
70
|
+
relations: ['communities', 'network'],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
findOneByUsername(username) {
|
|
74
|
+
return this.repository.findOneBy({ username });
|
|
75
|
+
}
|
|
76
|
+
update(id, updateUserDto) {
|
|
77
|
+
return `This action updates a #${id} user`;
|
|
78
|
+
}
|
|
79
|
+
remove(id) {
|
|
80
|
+
return `This action removes a #${id} user`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
exports.UserService = UserService;
|
|
84
|
+
exports.UserService = UserService = __decorate([
|
|
85
|
+
(0, common_1.Injectable)(),
|
|
86
|
+
__param(0, (0, typeorm_1.InjectRepository)(user_entity_1.User)),
|
|
87
|
+
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
88
|
+
typeorm_3.DataSource])
|
|
89
|
+
], UserService);
|
|
90
|
+
//# sourceMappingURL=user.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,6CAAmD;AACnD,wDAA8C;AAC9C,qCAAkD;AAClD,qDAAiD;AACjD,uDAG2B;AAC3B,qCAAqC;AAG9B,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEqB;IACxB;IAFnB,YAC2C,UAA4B,EACpD,UAAsB;QADE,eAAU,GAAV,UAAU,CAAkB;QACpD,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ,KAAK,CAAC,MAAM,CACV,EACE,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,GAOjB,EACD,WAAyB;QAEzB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAE3C,IAAI,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAI,EAAE;YAC1C,OAAO,EAAE,iBAAO,CAAC,UAAU,EAAE;YAC7B,QAAQ;YACR,IAAI;YACJ,KAAK;YACL,QAAQ;SACT,CAAC,CAAC;QAEH,OAAO,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAKD,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,WAAyB;QAEzB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;QACpD,CAAC;QAGD,MAAM,aAAa,GAAG,uBAAuB,CAAC;QAE9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,0CAAwB,CAChC,mGAAmG,CACpG,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,0CAAwB,CAChC,0CAA0C,CAC3C,CAAC;QACJ,CAAC;QAGD,MAAM,MAAM,GAAG,MAAM,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,kBAAI,EAAE;YACxD,OAAO,EAAE,iBAAO,CAAC,UAAU,EAAE;YAC7B,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;QAEH,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,wCAAsB,EAAE,CAAC;QACrC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC7B,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,QAAgB;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,aAA4B;QAC7C,OAAO,0BAA0B,EAAE,OAAO,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,0BAA0B,EAAE,OAAO,CAAC;IAC7C,CAAC;CACF,CAAA;AAxGY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCAA8B,oBAAU;QAClC,oBAAU;GAH9B,WAAW,CAwGvB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@social.dev/server-sdk",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"private": false,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"default": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*": {
|
|
15
|
+
"default": "./dist/*.js",
|
|
16
|
+
"types": "./dist/*.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"./dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@aws-sdk/client-s3": "^3.858.0",
|
|
24
|
+
"@casl/ability": "^6.7.3",
|
|
25
|
+
"@nestjs/axios": "^4.0.1",
|
|
26
|
+
"@nestjs/common": "^11.0.1",
|
|
27
|
+
"@nestjs/config": "^4.0.2",
|
|
28
|
+
"@nestjs/core": "^11.0.1",
|
|
29
|
+
"@nestjs/jwt": "^11.0.0",
|
|
30
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
31
|
+
"@nestjs/sequelize": "^11.0.0",
|
|
32
|
+
"@nestjs/swagger": "^11.1.6",
|
|
33
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
34
|
+
"axios": "^1.11.0",
|
|
35
|
+
"bl": "^6.1.1",
|
|
36
|
+
"class-transformer": "^0.5.1",
|
|
37
|
+
"cookie-parser": "^1.4.7",
|
|
38
|
+
"jose": "^6.0.13",
|
|
39
|
+
"nestjs-cls": "^6.0.1",
|
|
40
|
+
"pg": "^8.15.6",
|
|
41
|
+
"reflect-metadata": "^0.2.2",
|
|
42
|
+
"rm": "^0.1.8",
|
|
43
|
+
"rxjs": "^7.8.1",
|
|
44
|
+
"sequelize": "^6.37.7",
|
|
45
|
+
"sequelize-typescript": "^2.1.6",
|
|
46
|
+
"typeorm": "^0.3.23"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
50
|
+
"@eslint/js": "^9.18.0",
|
|
51
|
+
"@nestjs/cli": "^11.0.0",
|
|
52
|
+
"@nestjs/schematics": "^11.0.0",
|
|
53
|
+
"@nestjs/testing": "^11.0.1",
|
|
54
|
+
"@swc/cli": "^0.6.0",
|
|
55
|
+
"@swc/core": "^1.10.7",
|
|
56
|
+
"@types/cookie-parser": "^1.4.8",
|
|
57
|
+
"@types/express": "^5.0.0",
|
|
58
|
+
"@types/jest": "^29.5.14",
|
|
59
|
+
"@types/multer": "^2.0.0",
|
|
60
|
+
"@types/node": "^22.10.7",
|
|
61
|
+
"@types/supertest": "^6.0.2",
|
|
62
|
+
"eslint": "^9.18.0",
|
|
63
|
+
"eslint-config-prettier": "^10.0.1",
|
|
64
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
65
|
+
"globals": "^16.0.0",
|
|
66
|
+
"jest": "^29.7.0",
|
|
67
|
+
"prettier": "^3.4.2",
|
|
68
|
+
"source-map-support": "^0.5.21",
|
|
69
|
+
"supertest": "^7.0.0",
|
|
70
|
+
"ts-jest": "^29.2.5",
|
|
71
|
+
"ts-loader": "^9.5.2",
|
|
72
|
+
"ts-node": "^10.9.2",
|
|
73
|
+
"tsconfig-paths": "^4.2.0",
|
|
74
|
+
"typescript": "^5.7.3",
|
|
75
|
+
"typescript-eslint": "^8.20.0"
|
|
76
|
+
},
|
|
77
|
+
"jest": {
|
|
78
|
+
"moduleFileExtensions": [
|
|
79
|
+
"js",
|
|
80
|
+
"json",
|
|
81
|
+
"ts"
|
|
82
|
+
],
|
|
83
|
+
"rootDir": "src",
|
|
84
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
85
|
+
"transform": {
|
|
86
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
87
|
+
},
|
|
88
|
+
"collectCoverageFrom": [
|
|
89
|
+
"**/*.(t|j)s"
|
|
90
|
+
],
|
|
91
|
+
"coverageDirectory": "../coverage",
|
|
92
|
+
"testEnvironment": "node",
|
|
93
|
+
"moduleNameMapper": {
|
|
94
|
+
"^src/(.*)$": "<rootDir>/$1"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "nest build",
|
|
99
|
+
"build2": "tsc --build tsconfig.build.json",
|
|
100
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
101
|
+
"start": "nest start",
|
|
102
|
+
"dev": "nest build --watch",
|
|
103
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
104
|
+
"test": "jest",
|
|
105
|
+
"test:watch": "jest --watch",
|
|
106
|
+
"test:cov": "jest --coverage",
|
|
107
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
108
|
+
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
109
|
+
}
|
|
110
|
+
}
|