itlab-internal-services 2.15.7 → 2.16.0
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 +1 -187
- package/dist/classes/document-merger.class.js +3 -5
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.js +3 -1
- package/dist/classes/report-category.class.d.ts +55 -0
- package/dist/classes/report-category.class.js +120 -0
- package/dist/decorators/{account.decorator.d.ts → authenticated-account.decorator.d.ts} +4 -4
- package/dist/decorators/{account.decorator.js → authenticated-account.decorator.js} +8 -10
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +1 -1
- package/dist/exceptions/authenticated-user-required.exception.d.ts +34 -0
- package/dist/exceptions/authenticated-user-required.exception.js +51 -0
- package/dist/exceptions/bad-body.exception.d.ts +19 -8
- package/dist/exceptions/bad-body.exception.js +26 -10
- package/dist/exceptions/bad-parameter.exception.d.ts +23 -8
- package/dist/exceptions/bad-parameter.exception.js +41 -19
- package/dist/exceptions/duplicate.exception.d.ts +20 -8
- package/dist/exceptions/duplicate.exception.js +27 -10
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/exceptions/index.js +1 -0
- package/dist/functions/add-views-likes-virtuals.function.d.ts +15 -0
- package/dist/functions/add-views-likes-virtuals.function.js +43 -0
- package/dist/functions/create-internal-axios-client.function.js +2 -2
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/likeable.interface.d.ts +1 -1
- package/dist/likeable.interface.js +2 -2
- package/dist/models/account.model.d.ts +23 -0
- package/dist/models/account.model.js +59 -0
- package/dist/models/index.d.ts +3 -1
- package/dist/models/index.js +7 -3
- package/dist/{modules/search/models → models}/search-document.model.d.ts +1 -1
- package/dist/{modules/search/models → models}/search-document.model.js +1 -1
- package/dist/models/{account-entity.model.d.ts → user.model.d.ts} +8 -21
- package/dist/models/{account-entity.model.js → user.model.js} +11 -25
- package/dist/modules/authentication/authentication-module-options.interface.d.ts +2 -8
- package/dist/modules/authentication/authentication-options.parameter.d.ts +4 -0
- package/dist/modules/authentication/{inject-auth-options.decorator.js → authentication-options.parameter.js} +5 -2
- package/dist/modules/authentication/authentication.module.d.ts +23 -0
- package/dist/modules/authentication/authentication.module.js +24 -1
- package/dist/modules/authentication/guards/index.d.ts +2 -2
- package/dist/modules/authentication/guards/index.js +7 -7
- package/dist/modules/authentication/guards/jwt-auth.guard.d.ts +17 -0
- package/dist/modules/authentication/guards/jwt-auth.guard.js +73 -0
- package/dist/modules/authentication/guards/permissions.guard.d.ts +5 -27
- package/dist/modules/authentication/guards/permissions.guard.js +26 -59
- package/dist/modules/authentication/guards/public.guard.d.ts +7 -13
- package/dist/modules/authentication/guards/public.guard.js +10 -24
- package/dist/modules/authentication/guards/service-auth.guard.d.ts +22 -0
- package/dist/modules/authentication/guards/service-auth.guard.js +65 -0
- package/dist/modules/authentication/index.d.ts +3 -3
- package/dist/modules/authentication/index.js +3 -5
- package/dist/modules/cache/cache-response.interceptor.d.ts +2 -2
- package/dist/modules/cache/cache-response.interceptor.js +2 -2
- package/dist/modules/cache/index.d.ts +1 -0
- package/dist/modules/cache/index.js +1 -0
- package/dist/modules/comment/comment-module-options.interface.d.ts +38 -0
- package/dist/modules/comment/comment.controller.d.ts +24 -30
- package/dist/modules/comment/comment.controller.js +59 -61
- package/dist/modules/comment/comment.module-definition.d.ts +1 -42
- package/dist/modules/comment/comment.module-definition.js +1 -2
- package/dist/modules/comment/comment.module.d.ts +13 -13
- package/dist/modules/comment/comment.module.js +15 -42
- package/dist/modules/comment/comment.service.d.ts +27 -37
- package/dist/modules/comment/comment.service.js +50 -84
- package/dist/modules/comment/index.d.ts +2 -3
- package/dist/modules/comment/index.js +16 -7
- package/dist/modules/database/database.module.js +2 -5
- package/dist/modules/database/index.d.ts +2 -5
- package/dist/modules/database/index.js +17 -9
- package/dist/modules/index.d.ts +2 -6
- package/dist/modules/index.js +2 -6
- package/dist/modules/like/index.d.ts +2 -1
- package/dist/modules/like/index.js +16 -3
- package/dist/modules/like/like-module-options.interface.d.ts +21 -0
- package/dist/modules/like/like.controller.d.ts +45 -37
- package/dist/modules/like/like.controller.js +117 -102
- package/dist/modules/like/like.module-definition.d.ts +1 -17
- package/dist/modules/like/like.module-definition.js +1 -2
- package/dist/modules/like/like.module.d.ts +12 -12
- package/dist/modules/like/like.module.js +14 -37
- package/dist/modules/like/like.service.d.ts +31 -27
- package/dist/modules/like/like.service.js +42 -35
- package/dist/modules/merge/index.d.ts +3 -0
- package/dist/modules/merge/index.js +19 -0
- package/dist/modules/merge/merge-module-options.interface.d.ts +21 -0
- package/dist/modules/merge/merge.controller.d.ts +30 -0
- package/dist/modules/merge/merge.controller.js +76 -0
- package/dist/modules/merge/merge.module.d.ts +18 -0
- package/dist/modules/merge/merge.module.js +41 -0
- package/dist/modules/merge/merge.service.interface.d.ts +17 -0
- package/dist/modules/services/base-http.service.d.ts +83 -0
- package/dist/modules/services/base-http.service.js +124 -0
- package/dist/modules/services/base-urls.d.ts +22 -0
- package/dist/modules/services/base-urls.js +121 -0
- package/dist/modules/services/index.d.ts +4 -0
- package/dist/modules/services/index.js +20 -0
- package/dist/modules/services/providers/accounts.service.d.ts +52 -0
- package/dist/modules/services/providers/accounts.service.js +82 -0
- package/dist/modules/services/providers/books.service.d.ts +29 -0
- package/dist/modules/services/providers/books.service.js +53 -0
- package/dist/modules/services/providers/changelog.service.d.ts +18 -0
- package/dist/modules/services/providers/changelog.service.js +41 -0
- package/dist/modules/services/providers/comments/comments.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/comments/comments.service-definition.js +4 -0
- package/dist/modules/services/providers/comments/comments.service.d.ts +60 -0
- package/dist/modules/services/providers/comments/comments.service.js +138 -0
- package/dist/modules/services/providers/comments/index.d.ts +1 -0
- package/dist/{factories → modules/services/providers/comments}/index.js +1 -1
- package/dist/modules/services/providers/content/content-types.d.ts +20 -0
- package/dist/modules/services/providers/content/content-types.js +7 -0
- package/dist/modules/services/providers/content/content.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/content/content.service-definition.js +4 -0
- package/dist/modules/services/providers/content/content.service.d.ts +94 -0
- package/dist/modules/services/providers/content/content.service.js +214 -0
- package/dist/modules/services/providers/content/index.d.ts +1 -0
- package/dist/modules/{search/models → services/providers/content}/index.js +1 -1
- package/dist/modules/services/providers/demo-hive.service.d.ts +29 -0
- package/dist/modules/services/providers/demo-hive.service.js +53 -0
- package/dist/modules/services/providers/events.service.d.ts +29 -0
- package/dist/modules/services/providers/events.service.js +53 -0
- package/dist/modules/services/providers/hackschool.service.d.ts +49 -0
- package/dist/modules/services/providers/hackschool.service.js +77 -0
- package/dist/modules/services/providers/ideas.service.d.ts +18 -0
- package/dist/modules/services/providers/ideas.service.js +41 -0
- package/dist/modules/services/providers/index.d.ts +19 -0
- package/dist/modules/services/providers/index.js +35 -0
- package/dist/modules/services/providers/lunch-roulette.service.d.ts +18 -0
- package/dist/modules/services/providers/lunch-roulette.service.js +41 -0
- package/dist/modules/services/providers/mail/index.d.ts +3 -0
- package/dist/modules/services/providers/mail/index.js +19 -0
- package/dist/modules/services/providers/mail/mail-types.d.ts +30 -0
- package/dist/modules/services/providers/mail/mail-types.js +22 -0
- package/dist/modules/services/providers/mail/mail.service.d.ts +99 -0
- package/dist/modules/{mail → services/providers/mail}/mail.service.js +54 -91
- package/dist/modules/services/providers/newletter.service.d.ts +29 -0
- package/dist/modules/services/providers/newletter.service.js +53 -0
- package/dist/modules/services/providers/newsroom.service.d.ts +47 -0
- package/dist/modules/services/providers/newsroom.service.js +71 -0
- package/dist/modules/services/providers/notification/dtos/schedule-notification.dto.js +2 -0
- package/dist/modules/services/providers/notification/index.d.ts +2 -0
- package/dist/modules/services/providers/notification/index.js +18 -0
- package/dist/modules/services/providers/notification/notification.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/notification/notification.service-definition.js +4 -0
- package/dist/modules/services/providers/notification/notification.service.d.ts +50 -0
- package/dist/modules/services/providers/notification/notification.service.js +130 -0
- package/dist/modules/services/providers/pass/dtos/create-guild-member-pass.dto.js +2 -0
- package/dist/modules/services/providers/pass/dtos/create-team-member-pass.dto.js +2 -0
- package/dist/modules/services/providers/pass/index.d.ts +2 -0
- package/dist/modules/services/providers/pass/index.js +18 -0
- package/dist/modules/services/providers/pass/pass-types.d.ts +18 -0
- package/dist/modules/services/providers/pass/pass-types.js +7 -0
- package/dist/modules/{pass → services/providers/pass}/pass.service.d.ts +15 -39
- package/dist/modules/{pass → services/providers/pass}/pass.service.js +46 -61
- package/dist/modules/services/providers/podcasts.service.d.ts +29 -0
- package/dist/modules/services/providers/podcasts.service.js +53 -0
- package/dist/modules/services/providers/search/dtos/index-search-document.dto.js +2 -0
- package/dist/modules/services/providers/search/index.d.ts +2 -0
- package/dist/modules/services/providers/search/index.js +18 -0
- package/dist/modules/services/providers/search/search.service-definition.d.ts +1 -0
- package/dist/modules/services/providers/search/search.service-definition.js +4 -0
- package/dist/modules/services/providers/search/search.service.d.ts +66 -0
- package/dist/modules/services/providers/search/search.service.js +171 -0
- package/dist/modules/services/providers/team.service.d.ts +29 -0
- package/dist/modules/services/providers/team.service.js +53 -0
- package/dist/modules/services/providers/tech-radar.service.d.ts +39 -0
- package/dist/modules/services/providers/tech-radar.service.js +65 -0
- package/dist/modules/services/services-module-options.interface.d.ts +4 -0
- package/dist/modules/services/services-module-options.interface.js +2 -0
- package/dist/modules/services/services-options.parameter.d.ts +1 -0
- package/dist/modules/services/services-options.parameter.js +8 -0
- package/dist/modules/services/services.module-definition.d.ts +16 -0
- package/dist/modules/services/services.module-definition.js +21 -0
- package/dist/modules/services/services.module.d.ts +17 -0
- package/dist/modules/services/services.module.js +63 -0
- package/dist/pipes/index.d.ts +2 -3
- package/dist/pipes/index.js +2 -3
- package/dist/pipes/params/hub-id.pipe.d.ts +22 -0
- package/dist/pipes/{hub-id.pipe.js → params/hub-id.pipe.js} +14 -17
- package/dist/pipes/params/hub-resource.pipe.d.ts +22 -0
- package/dist/pipes/{hub-resource.pipe.js → params/hub-resource.pipe.js} +19 -20
- package/dist/pipes/params/index.d.ts +3 -0
- package/dist/pipes/params/index.js +19 -0
- package/dist/pipes/params/mongo-id.pipe.d.ts +15 -0
- package/dist/pipes/params/mongo-id.pipe.js +52 -0
- package/dist/pipes/queries/index.d.ts +3 -0
- package/dist/pipes/queries/index.js +19 -0
- package/dist/pipes/queries/mongo-ids.pipe.d.ts +22 -0
- package/dist/pipes/queries/mongo-ids.pipe.js +60 -0
- package/dist/pipes/queries/optional-boolean.pipe.d.ts +29 -0
- package/dist/pipes/queries/optional-boolean.pipe.js +72 -0
- package/dist/pipes/queries/optional-include-drafts.pipe.d.ts +28 -0
- package/dist/pipes/queries/optional-include-drafts.pipe.js +38 -0
- package/dist/properties/index.d.ts +1 -0
- package/dist/properties/index.js +5 -0
- package/dist/swagger/index.d.ts +1 -0
- package/dist/swagger/index.js +5 -0
- package/dist/swagger/remove-public-route-auth.plugin.d.ts +9 -0
- package/dist/swagger/remove-public-route-auth.plugin.js +25 -0
- package/dist/swagger/swagger-options.interface.d.ts +14 -0
- package/dist/swagger/swagger-options.interface.js +2 -0
- package/dist/swagger/swagger.function.d.ts +11 -0
- package/dist/swagger/swagger.function.js +47 -0
- package/dist/transform/boolean.transform.js +3 -3
- package/dist/viewable.interface.js +1 -1
- package/package.json +2 -2
- package/dist/factories/index.d.ts +0 -1
- package/dist/factories/virtuals.factory.d.ts +0 -79
- package/dist/factories/virtuals.factory.js +0 -171
- package/dist/modules/authentication/guards/auth.guard.d.ts +0 -36
- package/dist/modules/authentication/guards/auth.guard.js +0 -107
- package/dist/modules/authentication/guards/internal.guard.d.ts +0 -33
- package/dist/modules/authentication/guards/internal.guard.js +0 -72
- package/dist/modules/authentication/inject-auth-options.decorator.d.ts +0 -1
- package/dist/modules/comment/comment.model.d.ts +0 -29
- package/dist/modules/comment/comment.model.js +0 -43
- package/dist/modules/content/content.module-definition.d.ts +0 -5
- package/dist/modules/content/content.module-definition.js +0 -8
- package/dist/modules/content/content.module.d.ts +0 -31
- package/dist/modules/content/content.module.js +0 -60
- package/dist/modules/content/content.service.d.ts +0 -50
- package/dist/modules/content/content.service.js +0 -145
- package/dist/modules/content/index.d.ts +0 -3
- package/dist/modules/content/index.js +0 -9
- package/dist/modules/database/model-service/dbs/hub-account.db.d.ts +0 -28
- package/dist/modules/database/model-service/dbs/hub-account.db.js +0 -44
- package/dist/modules/database/model-service/dbs/hub-books.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-books.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-comments.db.d.ts +0 -29
- package/dist/modules/database/model-service/dbs/hub-comments.db.js +0 -68
- package/dist/modules/database/model-service/dbs/hub-content.db.d.ts +0 -24
- package/dist/modules/database/model-service/dbs/hub-content.db.js +0 -49
- package/dist/modules/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-demo-hive.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-events.db.d.ts +0 -24
- package/dist/modules/database/model-service/dbs/hub-events.db.js +0 -49
- package/dist/modules/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
- package/dist/modules/database/model-service/dbs/hub-hackschool.db.js +0 -106
- package/dist/modules/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
- package/dist/modules/database/model-service/dbs/hub-newsroom.db.js +0 -53
- package/dist/modules/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
- package/dist/modules/database/model-service/dbs/hub-podcasts.db.js +0 -45
- package/dist/modules/database/model-service/dbs/hub-team.db.d.ts +0 -22
- package/dist/modules/database/model-service/dbs/hub-team.db.js +0 -41
- package/dist/modules/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
- package/dist/modules/database/model-service/dbs/hub-tech-radar.db.js +0 -81
- package/dist/modules/database/model-service/model.service.d.ts +0 -6407
- package/dist/modules/database/model-service/model.service.js +0 -136
- package/dist/modules/database/populate-service/populate.service.d.ts +0 -73
- package/dist/modules/database/populate-service/populate.service.js +0 -163
- package/dist/modules/database/service-mapper-service/service-mapper.service.d.ts +0 -32
- package/dist/modules/database/service-mapper-service/service-mapper.service.js +0 -73
- package/dist/modules/fetch/fetch.module.d.ts +0 -31
- package/dist/modules/fetch/fetch.module.js +0 -60
- package/dist/modules/fetch/fetch.service.d.ts +0 -153
- package/dist/modules/fetch/fetch.service.js +0 -274
- package/dist/modules/fetch/index.d.ts +0 -2
- package/dist/modules/fetch/index.js +0 -7
- package/dist/modules/mail/index.d.ts +0 -4
- package/dist/modules/mail/index.js +0 -23
- package/dist/modules/mail/mail.module.d.ts +0 -31
- package/dist/modules/mail/mail.module.js +0 -60
- package/dist/modules/mail/mail.service.d.ts +0 -136
- package/dist/modules/notification/index.d.ts +0 -3
- package/dist/modules/notification/index.js +0 -22
- package/dist/modules/notification/notification.module-definition.d.ts +0 -5
- package/dist/modules/notification/notification.module-definition.js +0 -8
- package/dist/modules/notification/notification.module.d.ts +0 -34
- package/dist/modules/notification/notification.module.js +0 -63
- package/dist/modules/notification/notification.service.d.ts +0 -42
- package/dist/modules/notification/notification.service.js +0 -100
- package/dist/modules/pass/index.d.ts +0 -3
- package/dist/modules/pass/index.js +0 -22
- package/dist/modules/pass/pass.module.d.ts +0 -32
- package/dist/modules/pass/pass.module.js +0 -61
- package/dist/modules/search/index.d.ts +0 -4
- package/dist/modules/search/index.js +0 -23
- package/dist/modules/search/models/index.d.ts +0 -1
- package/dist/modules/search/search.module-definition.d.ts +0 -5
- package/dist/modules/search/search.module-definition.js +0 -8
- package/dist/modules/search/search.module.d.ts +0 -33
- package/dist/modules/search/search.module.js +0 -62
- package/dist/modules/search/search.service.d.ts +0 -49
- package/dist/modules/search/search.service.js +0 -120
- package/dist/pipes/hub-id.pipe.d.ts +0 -22
- package/dist/pipes/hub-resource.pipe.d.ts +0 -22
- package/dist/pipes/mongo-id.pipe.d.ts +0 -14
- package/dist/pipes/mongo-id.pipe.js +0 -52
- package/dist/swagger.config.d.ts +0 -36
- package/dist/swagger.config.js +0 -76
- /package/dist/modules/{mail/dtos/auth-login-token-mail.dto.js → comment/comment-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/auth-password-reset-mail.dto.js → like/like-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/event-cancel-mail.dto.js → merge/merge-module-options.interface.js} +0 -0
- /package/dist/modules/{mail/dtos/event-invite-mail.dto.js → merge/merge.service.interface.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/auth-login-token-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/idea-status-updated-mail.dto.js → services/providers/mail/dtos/auth-login-token-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/auth-password-reset-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/idea-submitted-mail.dto.js → services/providers/mail/dtos/auth-password-reset-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/event-cancel-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-cancel-mail.dto.js → services/providers/mail/dtos/event-cancel-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/event-invite-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-matched-mail.dto.js → services/providers/mail/dtos/event-invite-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/idea-status-updated-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-submitted-mail.dto.js → services/providers/mail/dtos/idea-status-updated-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/idea-submitted-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/lunch-roulette-unmatched-mail.dto.js → services/providers/mail/dtos/idea-submitted-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/index.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/index.js +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-cancel-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-issue-mail.dto.js → services/providers/mail/dtos/lunch-roulette-cancel-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-matched-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-subscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-matched-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-submitted-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/newsletter-unsubscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-submitted-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-unmatched-mail.dto.d.ts +0 -0
- /package/dist/modules/{mail/dtos/notification-mail.dto.js → services/providers/mail/dtos/lunch-roulette-unmatched-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-issue-mail.dto.d.ts +0 -0
- /package/dist/modules/{notification/dtos/schedule-notification.dto.js → services/providers/mail/dtos/newsletter-issue-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-subscribed-mail.dto.d.ts +0 -0
- /package/dist/modules/{pass/dtos/create-guild-member-pass.dto.js → services/providers/mail/dtos/newsletter-subscribed-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-unsubscribed-mail.dto.d.ts +0 -0
- /package/dist/modules/{pass/dtos/create-team-member-pass.dto.js → services/providers/mail/dtos/newsletter-unsubscribed-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/dtos/notification-mail.dto.d.ts +0 -0
- /package/dist/modules/{search/dtos/index-search-document.dto.js → services/providers/mail/dtos/notification-mail.dto.js} +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/index.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/index.js +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.d.ts +0 -0
- /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.js +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/index.d.ts +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/index.js +0 -0
- /package/dist/modules/{notification → services/providers/notification}/dtos/schedule-notification.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/create-guild-member-pass.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/create-team-member-pass.dto.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/index.d.ts +0 -0
- /package/dist/modules/{pass → services/providers/pass}/dtos/index.js +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index-search-document.dto.d.ts +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index.d.ts +0 -0
- /package/dist/modules/{search → services/providers/search}/dtos/index.js +0 -0
- /package/dist/{modules/content → properties}/content.property.d.ts +0 -0
- /package/dist/{modules/content → properties}/content.property.js +0 -0
|
@@ -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
|
+
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.ServiceAuthGuard = exports.SERVICE_AUTH_HEADER_KEY = void 0;
|
|
16
|
+
exports.isServiceRequest = isServiceRequest;
|
|
17
|
+
exports.RequireServiceAuth = RequireServiceAuth;
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const core_1 = require("@nestjs/core");
|
|
20
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
+
const authentication_options_parameter_1 = require("../authentication-options.parameter");
|
|
22
|
+
const public_guard_1 = require("./public.guard");
|
|
23
|
+
/** Header key used for internal Kubernetes service authentication */
|
|
24
|
+
exports.SERVICE_AUTH_HEADER_KEY = 'X-itlab-k8s-auth';
|
|
25
|
+
/**
|
|
26
|
+
* Guard validating service-to-service requests using a shared token.
|
|
27
|
+
*/
|
|
28
|
+
let ServiceAuthGuard = class ServiceAuthGuard {
|
|
29
|
+
constructor(authenticationOptions, reflector) {
|
|
30
|
+
this.authenticationOptions = authenticationOptions;
|
|
31
|
+
this.reflector = reflector;
|
|
32
|
+
}
|
|
33
|
+
canActivate(context) {
|
|
34
|
+
if ((0, public_guard_1.isPublicRoute)(context, this.reflector))
|
|
35
|
+
return true;
|
|
36
|
+
if (isServiceRequest(context, this.authenticationOptions.k8sToken))
|
|
37
|
+
return true;
|
|
38
|
+
throw new common_1.UnauthorizedException('Application unauthorized');
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.ServiceAuthGuard = ServiceAuthGuard;
|
|
42
|
+
exports.ServiceAuthGuard = ServiceAuthGuard = __decorate([
|
|
43
|
+
(0, common_1.Injectable)(),
|
|
44
|
+
__param(0, (0, authentication_options_parameter_1.InjectAuthenticationOptions)()),
|
|
45
|
+
__metadata("design:paramtypes", [Object, core_1.Reflector])
|
|
46
|
+
], ServiceAuthGuard);
|
|
47
|
+
/**
|
|
48
|
+
* Check if request contains the required internal service token.
|
|
49
|
+
*/
|
|
50
|
+
function isServiceRequest(context, requiredk8sToken) {
|
|
51
|
+
const request = context.switchToHttp().getRequest();
|
|
52
|
+
const token = request.header(exports.SERVICE_AUTH_HEADER_KEY);
|
|
53
|
+
return token && token === requiredk8sToken;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Decorator for routes/controllers accessible only by internal services.
|
|
57
|
+
*/
|
|
58
|
+
function RequireServiceAuth() {
|
|
59
|
+
return (0, common_1.applyDecorators)((0, common_1.UseGuards)(ServiceAuthGuard), (0, swagger_1.ApiTags)('Internal'), (0, swagger_1.ApiSecurity)('Service Token'), (0, swagger_1.ApiHeader)({
|
|
60
|
+
name: exports.SERVICE_AUTH_HEADER_KEY,
|
|
61
|
+
description: 'Token for service authentication',
|
|
62
|
+
allowEmptyValue: true,
|
|
63
|
+
required: true,
|
|
64
|
+
}), (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Application unauthorized' }));
|
|
65
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export * from './authentication-module-options.interface';
|
|
2
|
+
export * from './authentication-options.parameter';
|
|
3
|
+
export * from './authentication.module';
|
|
1
4
|
export * from './guards';
|
|
2
|
-
export { AuthenticationModuleOptions } from './authentication-module-options.interface';
|
|
3
|
-
export { AuthenticationModule } from './authentication.module';
|
|
4
|
-
export { InjectAuthOptions } from './inject-auth-options.decorator';
|
|
@@ -14,9 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
__exportStar(require("./authentication-module-options.interface"), exports);
|
|
18
|
+
__exportStar(require("./authentication-options.parameter"), exports);
|
|
19
|
+
__exportStar(require("./authentication.module"), exports);
|
|
18
20
|
__exportStar(require("./guards"), exports);
|
|
19
|
-
var authentication_module_1 = require("./authentication.module");
|
|
20
|
-
Object.defineProperty(exports, "AuthenticationModule", { enumerable: true, get: function () { return authentication_module_1.AuthenticationModule; } });
|
|
21
|
-
var inject_auth_options_decorator_1 = require("./inject-auth-options.decorator");
|
|
22
|
-
Object.defineProperty(exports, "InjectAuthOptions", { enumerable: true, get: function () { return inject_auth_options_decorator_1.InjectAuthOptions; } });
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Custom decorator to enable response caching for a controller method using NestJS CacheInterceptor.
|
|
5
5
|
* This improves performance by avoiding repeated execution for identical requests.
|
|
6
6
|
*
|
|
7
|
-
* If a TTL (Time-To-Live) is provided, the cached result will expire after the given duration (in
|
|
7
|
+
* If a TTL (Time-To-Live) is provided, the cached result will expire after the given duration (in milliseconds).
|
|
8
8
|
*
|
|
9
|
-
* @param {number} [ttl] - Optional time-to-live for the cached response in
|
|
9
|
+
* @param {number} [ttl] - Optional time-to-live for the cached response in milliseconds.
|
|
10
10
|
* @returns {MethodDecorator} A method decorator that applies caching logic to the handler.
|
|
11
11
|
*/
|
|
12
12
|
export declare function CacheResponse(ttl?: number): MethodDecorator;
|
|
@@ -9,9 +9,9 @@ const common_1 = require("@nestjs/common");
|
|
|
9
9
|
* Custom decorator to enable response caching for a controller method using NestJS CacheInterceptor.
|
|
10
10
|
* This improves performance by avoiding repeated execution for identical requests.
|
|
11
11
|
*
|
|
12
|
-
* If a TTL (Time-To-Live) is provided, the cached result will expire after the given duration (in
|
|
12
|
+
* If a TTL (Time-To-Live) is provided, the cached result will expire after the given duration (in milliseconds).
|
|
13
13
|
*
|
|
14
|
-
* @param {number} [ttl] - Optional time-to-live for the cached response in
|
|
14
|
+
* @param {number} [ttl] - Optional time-to-live for the cached response in milliseconds.
|
|
15
15
|
* @returns {MethodDecorator} A method decorator that applies caching logic to the handler.
|
|
16
16
|
*/
|
|
17
17
|
function CacheResponse(ttl) {
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cache-module-options.interface"), exports);
|
|
17
18
|
__exportStar(require("./cache-response.interceptor"), exports);
|
|
18
19
|
__exportStar(require("./cache.module"), exports);
|
|
19
20
|
__exportStar(require("./cache.service"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ModelDefinition } from '@nestjs/mongoose';
|
|
2
|
+
import { Document } from 'mongoose';
|
|
3
|
+
import { HubResource } from '../../hub-resource.enum';
|
|
4
|
+
/**
|
|
5
|
+
* Module options for configuring and dynamically registering the CommentModule.
|
|
6
|
+
*
|
|
7
|
+
* This allows developers to specify the resource model that supports "commenting"
|
|
8
|
+
* and optionally provide a custom route suffix. The modular design ensures
|
|
9
|
+
* consistent, reusable comment functionality across multiple resource types
|
|
10
|
+
* (e.g. News, Events, Demos).
|
|
11
|
+
*/
|
|
12
|
+
export type CommentModuleOptions<T extends Document> = {
|
|
13
|
+
/**
|
|
14
|
+
* The enum value identifying the resource type this comment module relates to.
|
|
15
|
+
* Used internally for routing and tagging.
|
|
16
|
+
*/
|
|
17
|
+
resource: HubResource;
|
|
18
|
+
/**
|
|
19
|
+
* Mongoose model definition representing the resource type
|
|
20
|
+
* that can receive comments.
|
|
21
|
+
*/
|
|
22
|
+
model: ModelDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* Optional suffix used to customize the controller route.
|
|
25
|
+
* For example, setting this to "news" will expose routes comment `/comment/news/:id`.
|
|
26
|
+
*/
|
|
27
|
+
routeSuffix?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Field name on the resource document representing a single owner's ID.
|
|
30
|
+
* Enables access control and filtering of comments by ownership.
|
|
31
|
+
*/
|
|
32
|
+
ownerIdField?: keyof Omit<T, keyof Document>;
|
|
33
|
+
/**
|
|
34
|
+
* Field name on the resource document representing multiple owner IDs.
|
|
35
|
+
* Useful for shared or collaborative resource ownership models.
|
|
36
|
+
*/
|
|
37
|
+
ownerIdsField?: keyof Omit<T, keyof Document>;
|
|
38
|
+
};
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import { LabContentRichtext } from 'itlab-functions';
|
|
2
|
-
import { Comment } from './comment.model';
|
|
1
|
+
import { LabCommentPopulated, LabContentRichtext } from 'itlab-functions';
|
|
3
2
|
import { CommentService } from './comment.service';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @description
|
|
7
|
-
* Handles HTTP endpoints for adding comments to a resource.
|
|
8
|
-
* Requires authenticated users and validates the resource ID using a MongoDB ObjectId format.
|
|
9
|
-
* Delegates comment logic to CommentService.
|
|
4
|
+
* Factory function for creating a CommentController bound to a specific route suffix.
|
|
10
5
|
*
|
|
11
|
-
*
|
|
6
|
+
* Why: Instead of writing separate controllers for each resource type,
|
|
7
|
+
* we generate one dynamically. This ensures DRY principles while still
|
|
8
|
+
* supporting custom routes (e.g. `/comment/news` or `/comment/event`).
|
|
12
9
|
*
|
|
13
|
-
*
|
|
10
|
+
* @param {string} [routeSuffix] - Optional suffix appended to the "comment" route.
|
|
11
|
+
* @returns A dynamically generated controller class.
|
|
14
12
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* @returns {Promise<Comment>} - The saved comment returned by the comment service
|
|
33
|
-
*/
|
|
34
|
-
postComment(resourceId: string, accountId: string, comment: LabContentRichtext): Promise<Comment>;
|
|
35
|
-
}
|
|
13
|
+
export declare function createCommentController(routeSuffix?: string): {
|
|
14
|
+
new (commentService: CommentService): {
|
|
15
|
+
readonly commentService: CommentService;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new comment on a specific resource.
|
|
18
|
+
*
|
|
19
|
+
* Why: Centralizes comment creation logic in the service while ensuring
|
|
20
|
+
* authentication, resource validation, and proper rich text handling.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} resourceId - MongoDB ObjectId of the resource being commented on.
|
|
23
|
+
* @param {string} accountId - Authenticated user's account ID.
|
|
24
|
+
* @param {LabContentRichtext} comment - Rich text content of the comment.
|
|
25
|
+
* @returns {Promise<LabCommentPopulated>} The saved comment object.
|
|
26
|
+
*/
|
|
27
|
+
postComment(resourceId: string, accountId: string, comment: LabContentRichtext): Promise<LabCommentPopulated>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -12,75 +12,73 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.createCommentController = createCommentController;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const swagger_1 = require("@nestjs/swagger");
|
|
18
18
|
const decorators_1 = require("../../decorators");
|
|
19
19
|
const exceptions_1 = require("../../exceptions");
|
|
20
20
|
const pipes_1 = require("../../pipes");
|
|
21
21
|
const authentication_1 = require("../authentication");
|
|
22
|
-
const comment_model_1 = require("./comment.model");
|
|
23
22
|
const comment_service_1 = require("./comment.service");
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @description
|
|
27
|
-
* Handles HTTP endpoints for adding comments to a resource.
|
|
28
|
-
* Requires authenticated users and validates the resource ID using a MongoDB ObjectId format.
|
|
29
|
-
* Delegates comment logic to CommentService.
|
|
24
|
+
* Factory function for creating a CommentController bound to a specific route suffix.
|
|
30
25
|
*
|
|
31
|
-
*
|
|
26
|
+
* Why: Instead of writing separate controllers for each resource type,
|
|
27
|
+
* we generate one dynamically. This ensures DRY principles while still
|
|
28
|
+
* supporting custom routes (e.g. `/comment/news` or `/comment/event`).
|
|
32
29
|
*
|
|
33
|
-
*
|
|
30
|
+
* @param {string} [routeSuffix] - Optional suffix appended to the "comment" route.
|
|
31
|
+
* @returns A dynamically generated controller class.
|
|
34
32
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
33
|
+
function createCommentController(routeSuffix) {
|
|
34
|
+
// Normalize route path, removing duplicate/trailing slashes
|
|
35
|
+
const normalizedRoute = `comment/${routeSuffix || ''}`.replace(/\/{2,}/g, '/').replace(/\/$/, '');
|
|
36
|
+
let CommentController = class CommentController {
|
|
37
|
+
constructor(commentService) {
|
|
38
|
+
this.commentService = commentService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new comment on a specific resource.
|
|
42
|
+
*
|
|
43
|
+
* Why: Centralizes comment creation logic in the service while ensuring
|
|
44
|
+
* authentication, resource validation, and proper rich text handling.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} resourceId - MongoDB ObjectId of the resource being commented on.
|
|
47
|
+
* @param {string} accountId - Authenticated user's account ID.
|
|
48
|
+
* @param {LabContentRichtext} comment - Rich text content of the comment.
|
|
49
|
+
* @returns {Promise<LabCommentPopulated>} The saved comment object.
|
|
50
|
+
*/
|
|
51
|
+
async postComment(resourceId, accountId, comment) {
|
|
52
|
+
return this.commentService.postComment(resourceId, accountId, comment);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiOperation)({
|
|
57
|
+
summary: 'Create a comment',
|
|
58
|
+
description: 'Adds a new comment to the specified resource. ' +
|
|
59
|
+
'The request is authenticated, and the comment is validated before saving. ' +
|
|
60
|
+
'Rich text content is supported.',
|
|
61
|
+
}),
|
|
62
|
+
(0, swagger_1.ApiOkResponse)({
|
|
63
|
+
description: 'The comment has been successfully saved.',
|
|
64
|
+
}),
|
|
65
|
+
(0, exceptions_1.ApiBadBodyResponse)('Invalid comment payload. Please check the content format.'),
|
|
66
|
+
(0, swagger_1.ApiNotFoundResponse)({ description: 'Resource not found. Cannot add comment to non-existent resource.' }),
|
|
67
|
+
(0, swagger_1.ApiBody)({ description: 'Comment content in rich text format.' }),
|
|
68
|
+
(0, pipes_1.ApiMongoIdParam)('resourceId'),
|
|
69
|
+
(0, common_1.Post)(':resourceId'),
|
|
70
|
+
__param(0, (0, pipes_1.MongoIdParam)('resourceId')),
|
|
71
|
+
__param(1, (0, decorators_1.AuthenticatedAccount)('id')),
|
|
72
|
+
__param(2, (0, common_1.Body)()),
|
|
73
|
+
__metadata("design:type", Function),
|
|
74
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
75
|
+
__metadata("design:returntype", Promise)
|
|
76
|
+
], CommentController.prototype, "postComment", null);
|
|
77
|
+
CommentController = __decorate([
|
|
78
|
+
(0, authentication_1.RequireJwtAuth)(),
|
|
79
|
+
(0, swagger_1.ApiTags)('Comment'),
|
|
80
|
+
(0, common_1.Controller)(normalizedRoute),
|
|
81
|
+
__metadata("design:paramtypes", [comment_service_1.CommentService])
|
|
82
|
+
], CommentController);
|
|
83
|
+
return CommentController;
|
|
84
|
+
}
|
|
@@ -1,45 +1,4 @@
|
|
|
1
|
-
import { ModelDefinition } from '@nestjs/mongoose';
|
|
2
|
-
import { Document } from 'mongoose';
|
|
3
|
-
import { HubResource } from '../../hub-resource.enum';
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* This structure allows customization of routes, Swagger tags, and field-level ownership logic
|
|
8
|
-
* for different resource types (e.g., posts, articles, media).
|
|
9
|
-
*
|
|
10
|
-
* @template T - The type of the resource document.
|
|
11
|
-
*/
|
|
12
|
-
export type CommentModuleOptions<T extends Document = any> = {
|
|
13
|
-
/**
|
|
14
|
-
* The enum value identifying the resource type this comment module relates to.
|
|
15
|
-
* Used internally for routing and tagging.
|
|
16
|
-
*/
|
|
17
|
-
resource: HubResource;
|
|
18
|
-
/**
|
|
19
|
-
* Optional array of path segments used to define the controller route and Swagger tag suffix.
|
|
20
|
-
* Enables modular comment endpoints for different resource domains.
|
|
21
|
-
*
|
|
22
|
-
* Example: ['posts', 'featured'] → route: /comment/posts/featured
|
|
23
|
-
*/
|
|
24
|
-
routeScope?: string[];
|
|
25
|
-
/**
|
|
26
|
-
* Optional Mongoose model definition for the resource to which comments are attached.
|
|
27
|
-
* If not provided, the module will skip controller registration.
|
|
28
|
-
*/
|
|
29
|
-
model?: ModelDefinition;
|
|
30
|
-
/**
|
|
31
|
-
* Field name on the resource document representing a single owner's ID.
|
|
32
|
-
* Enables access control and filtering of comments by ownership.
|
|
33
|
-
*/
|
|
34
|
-
ownerIdField?: keyof Omit<T, keyof Document>;
|
|
35
|
-
/**
|
|
36
|
-
* Field name on the resource document representing multiple owner IDs.
|
|
37
|
-
* Useful for shared or collaborative resource ownership models.
|
|
38
|
-
*/
|
|
39
|
-
ownerIdsField?: keyof Omit<T, keyof Document>;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Token used to inject CommentModule options into services or controllers if needed.
|
|
43
|
-
* Symbol is used to avoid accidental naming collisions across modules.
|
|
2
|
+
* Dependency injection token for CommentModule options.
|
|
44
3
|
*/
|
|
45
4
|
export declare const COMMENT_MODULE_OPTIONS_TOKEN: unique symbol;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.COMMENT_MODULE_OPTIONS_TOKEN = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Symbol is used to avoid accidental naming collisions across modules.
|
|
5
|
+
* Dependency injection token for CommentModule options.
|
|
7
6
|
*/
|
|
8
7
|
exports.COMMENT_MODULE_OPTIONS_TOKEN = Symbol('COMMENT_MODULE_OPTIONS_TOKEN');
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
|
2
2
|
import { Document } from 'mongoose';
|
|
3
|
-
import { CommentModuleOptions } from './comment
|
|
3
|
+
import { CommentModuleOptions } from './comment-module-options.interface';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* CommentModule dynamically registers controllers and services
|
|
6
|
+
* to handle "commenting" functionality for a given resource model.
|
|
7
|
+
*
|
|
8
|
+
* Why: Many resources (e.g. blogposts, events, demos) can be commented,
|
|
9
|
+
* but duplicating controller/service logic for each would be error-prone.
|
|
10
|
+
* Instead, this module centralizes the commenting-related logic, keeping it
|
|
11
|
+
* consistent while still allowing customization via options.
|
|
9
12
|
*/
|
|
10
13
|
export declare class CommentModule {
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* Dynamically registers a CommentController bound to the provided model
|
|
16
|
+
* and optional route suffix.
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @template T - The resource document type the comment module is tied to.
|
|
18
|
-
* @param options - Configuration values for routing, model binding, and ownership strategy.
|
|
19
|
-
* @returns A fully configured NestJS DynamicModule.
|
|
18
|
+
* @param {CommentModuleOptions} options - Configuration for the resource model and route.
|
|
19
|
+
* @returns {DynamicModule} The dynamically created module definition.
|
|
20
20
|
*/
|
|
21
|
-
static
|
|
21
|
+
static forFeature<T extends Document>(options: CommentModuleOptions<T>): DynamicModule;
|
|
22
22
|
}
|
|
@@ -9,63 +9,36 @@ var CommentModule_1;
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CommentModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
13
|
-
const itlab_functions_1 = require("itlab-functions");
|
|
14
12
|
const comment_controller_1 = require("./comment.controller");
|
|
15
13
|
const comment_module_definition_1 = require("./comment.module-definition");
|
|
16
14
|
const comment_service_1 = require("./comment.service");
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* CommentModule dynamically registers controllers and services
|
|
17
|
+
* to handle "commenting" functionality for a given resource model.
|
|
18
|
+
*
|
|
19
|
+
* Why: Many resources (e.g. blogposts, events, demos) can be commented,
|
|
20
|
+
* but duplicating controller/service logic for each would be error-prone.
|
|
21
|
+
* Instead, this module centralizes the commenting-related logic, keeping it
|
|
22
|
+
* consistent while still allowing customization via options.
|
|
22
23
|
*/
|
|
23
24
|
let CommentModule = CommentModule_1 = class CommentModule {
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* Dynamically registers a CommentController bound to the provided model
|
|
27
|
+
* and optional route suffix.
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @template T - The resource document type the comment module is tied to.
|
|
31
|
-
* @param options - Configuration values for routing, model binding, and ownership strategy.
|
|
32
|
-
* @returns A fully configured NestJS DynamicModule.
|
|
29
|
+
* @param {CommentModuleOptions} options - Configuration for the resource model and route.
|
|
30
|
+
* @returns {DynamicModule} The dynamically created module definition.
|
|
33
31
|
*/
|
|
34
|
-
static
|
|
35
|
-
const
|
|
36
|
-
if (options.model) {
|
|
37
|
-
const { routeScope = [] } = options;
|
|
38
|
-
// Transform suffixes into a readable Swagger tag (e.g., "Comment Module - Posts")
|
|
39
|
-
const swaggerTag = ['Comment Module', ...routeScope.map((scope) => (0, itlab_functions_1.capitalize)(scope))].join(' -');
|
|
40
|
-
// Build the controller route path (e.g., "/comment/posts")
|
|
41
|
-
const controllerRoutePath = ['comment', ...routeScope].join('/');
|
|
42
|
-
/**
|
|
43
|
-
* A dynamically scoped CommentController for a specific resource.
|
|
44
|
-
*
|
|
45
|
-
* This controller uses a generated route path and custom Swagger tag,
|
|
46
|
-
* but otherwise inherits all base CommentController behavior.
|
|
47
|
-
*/
|
|
48
|
-
let CommentController = class CommentController extends comment_controller_1.CommentController {
|
|
49
|
-
};
|
|
50
|
-
CommentController = __decorate([
|
|
51
|
-
(0, swagger_1.ApiTags)(swaggerTag),
|
|
52
|
-
(0, common_1.Controller)(controllerRoutePath)
|
|
53
|
-
], CommentController);
|
|
54
|
-
controllers.push(CommentController);
|
|
55
|
-
}
|
|
32
|
+
static forFeature(options) {
|
|
33
|
+
const CommentController = (0, comment_controller_1.createCommentController)(options.routeSuffix);
|
|
56
34
|
return {
|
|
57
35
|
module: CommentModule_1,
|
|
58
|
-
controllers: controllers,
|
|
59
36
|
providers: [comment_service_1.CommentService, { provide: comment_module_definition_1.COMMENT_MODULE_OPTIONS_TOKEN, useValue: options }],
|
|
60
|
-
|
|
37
|
+
controllers: [CommentController],
|
|
61
38
|
};
|
|
62
39
|
}
|
|
63
40
|
};
|
|
64
41
|
exports.CommentModule = CommentModule;
|
|
65
42
|
exports.CommentModule = CommentModule = CommentModule_1 = __decorate([
|
|
66
|
-
(0, common_1.Module)({
|
|
67
|
-
controllers: [comment_controller_1.CommentController],
|
|
68
|
-
providers: [comment_service_1.CommentService],
|
|
69
|
-
exports: [comment_service_1.CommentService],
|
|
70
|
-
})
|
|
43
|
+
(0, common_1.Module)({})
|
|
71
44
|
], CommentModule);
|
|
@@ -1,54 +1,44 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { LabContentRichtext } from 'itlab-functions';
|
|
2
|
+
import { LabCommentPopulated, LabContentRichtext } from 'itlab-functions';
|
|
3
3
|
import { Connection } from 'mongoose';
|
|
4
4
|
import { AuthenticationModuleOptions } from '../authentication';
|
|
5
|
-
import {
|
|
6
|
-
import { CommentModuleOptions } from './comment
|
|
5
|
+
import { BaseHttpService } from '../services/base-http.service';
|
|
6
|
+
import { CommentModuleOptions } from './comment-module-options.interface';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* CommentService manages persistence and business logic
|
|
9
|
+
* for adding, comments on resource entities.
|
|
10
|
+
*
|
|
11
|
+
* Why: Encapsulates MongoDB operations and ensures consistent handling
|
|
12
|
+
* of comment-related behavior across all resources that support comments.
|
|
12
13
|
*/
|
|
13
|
-
export declare class CommentService {
|
|
14
|
+
export declare class CommentService extends BaseHttpService {
|
|
14
15
|
private readonly moduleOptions;
|
|
15
16
|
private readonly connection;
|
|
16
|
-
private readonly authOptions;
|
|
17
|
-
private readonly configService;
|
|
18
|
-
private readonly logger;
|
|
19
|
-
private readonly axiosInstance;
|
|
20
|
-
private readonly resource;
|
|
21
17
|
private readonly commentModel;
|
|
22
18
|
/**
|
|
23
|
-
*
|
|
24
|
-
* an axios client for internal comment service communication.
|
|
19
|
+
* Constructs the CommentService with a configured model instance.
|
|
25
20
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param authOptions - Auth options including Kubernetes token for service calls
|
|
29
|
-
* @param configService - Global config service for environment settings
|
|
30
|
-
*/
|
|
31
|
-
constructor(moduleOptions: CommentModuleOptions, connection: Connection | undefined, authOptions: AuthenticationModuleOptions, configService: ConfigService);
|
|
32
|
-
/**
|
|
33
|
-
* Posts a comment to a given resource, with optional ownership metadata attached.
|
|
34
|
-
*
|
|
35
|
-
* - Validates that the resource exists if a model is defined.
|
|
36
|
-
* - Looks up `ownerId` or `ownerIds` for authorization use by downstream services.
|
|
21
|
+
* Why: Using the provided Mongoose connection and model options ensures
|
|
22
|
+
* that comments are tied to the correct resource collection dynamically.
|
|
37
23
|
*
|
|
38
|
-
* @param {
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {LabContentRichtext} comment - Comment content in rich-text format
|
|
41
|
-
* @returns {Promise<Comment>} - Resolves with the saved comment or throws an HTTP exception
|
|
24
|
+
* @param {CommentModuleOptions} moduleOptions - Config for the commentable resource model.
|
|
25
|
+
* @param {Connection} connection - Mongoose database connection.
|
|
42
26
|
*/
|
|
43
|
-
|
|
27
|
+
constructor(moduleOptions: CommentModuleOptions<any>, connection: Connection, authenticationOptions: AuthenticationModuleOptions, configService: ConfigService);
|
|
44
28
|
/**
|
|
45
|
-
*
|
|
29
|
+
* Posts a comment to a given resource, optionally attaching ownership metadata.
|
|
46
30
|
*
|
|
47
|
-
*
|
|
48
|
-
* -
|
|
31
|
+
* Why:
|
|
32
|
+
* - Ensures that the resource exists before attempting to save a comment.
|
|
33
|
+
* - Optionally extracts `ownerId` or `ownerIds` for downstream authorization or notifications.
|
|
34
|
+
* - Wraps the internal HTTP call in a promise with proper error handling and logging.
|
|
49
35
|
*
|
|
50
|
-
* @param {string} resourceId -
|
|
51
|
-
* @
|
|
36
|
+
* @param {string} resourceId - MongoDB ObjectId of the resource being commented on.
|
|
37
|
+
* @param {string} accountId - Authenticated user ID posting the comment.
|
|
38
|
+
* @param {LabContentRichtext} richtext - Comment content in rich-text format.
|
|
39
|
+
* @returns {Promise<LabCommentPopulated>} Resolves with the saved comment or throws an HTTP exception.
|
|
40
|
+
* @throws {NotFoundException} If the resource does not exist.
|
|
41
|
+
* @throws {HttpException} If the internal service call fails.
|
|
52
42
|
*/
|
|
53
|
-
|
|
43
|
+
postComment(resourceId: string, accountId: string, richtext: LabContentRichtext): Promise<LabCommentPopulated>;
|
|
54
44
|
}
|