@comasoft/nestjs 0.1.8 → 0.1.9

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.
@@ -1,18 +1,20 @@
1
- import { FILE_STATUS } from '../../enums.common';
1
+ import { FILE_STATUS, FILE_STORAGE_TYPE } from '../../enums.common';
2
2
  export declare class File {
3
3
  id: number;
4
4
  status: FILE_STATUS;
5
+ storage_type: FILE_STORAGE_TYPE;
5
6
  target: string;
6
7
  target_id: number;
7
8
  user_id: number;
8
- original_name: string;
9
+ original_name?: string;
9
10
  file_name: string;
10
11
  path: string;
11
- mime_type: string;
12
- size: number;
12
+ mime_type?: string;
13
+ size?: number;
13
14
  meta: Record<string, any>;
14
15
  group_number: number;
15
16
  sort: number;
17
+ has_thumbnail: boolean;
16
18
  is_active: boolean;
17
19
  created_at: Date;
18
20
  updated_at: Date;
@@ -1 +1 @@
1
- var e=this&&this.__decorate||function(e,t,o,i){var n,r=arguments.length,p=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(p=(r<3?n(p):r>3?n(t,o,p):n(t,o))||p);return r>3&&p&&Object.defineProperty(t,o,p),p},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.File=void 0;const o=require("typeorm"),i=require("../../enums.common");let n=class File{};exports.File=n,e([(0,o.PrimaryGeneratedColumn)({name:"id",primaryKeyConstraintName:"PK_files"}),t("design:type",Number)],n.prototype,"id",void 0),e([(0,o.Column)("enum",{enum:i.FILE_STATUS}),t("design:type",String)],n.prototype,"status",void 0),e([(0,o.Column)("varchar",{length:25}),t("design:type",String)],n.prototype,"target",void 0),e([(0,o.Column)("int"),t("design:type",Number)],n.prototype,"target_id",void 0),e([(0,o.Column)("int",{nullable:!0}),t("design:type",Number)],n.prototype,"user_id",void 0),e([(0,o.Column)("varchar",{length:255}),t("design:type",String)],n.prototype,"original_name",void 0),e([(0,o.Column)("varchar",{length:255,comment:"UUID 기반 파일명"}),t("design:type",String)],n.prototype,"file_name",void 0),e([(0,o.Column)("varchar",{length:255,comment:"[target]/YYMMDD/[file_name]"}),t("design:type",String)],n.prototype,"path",void 0),e([(0,o.Column)("varchar",{length:100}),t("design:type",String)],n.prototype,"mime_type",void 0),e([(0,o.Column)("int"),t("design:type",Number)],n.prototype,"size",void 0),e([(0,o.Column)("jsonb",{nullable:!0}),t("design:type",Object)],n.prototype,"meta",void 0),e([(0,o.Column)("smallint",{default:0,comment:"0: cover, 1: details ..."}),t("design:type",Number)],n.prototype,"group_number",void 0),e([(0,o.Column)("int",{default:0}),t("design:type",Number)],n.prototype,"sort",void 0),e([(0,o.Column)("boolean",{default:!0}),t("design:type",Boolean)],n.prototype,"is_active",void 0),e([(0,o.CreateDateColumn)({type:"timestamptz"}),t("design:type",Date)],n.prototype,"created_at",void 0),e([(0,o.UpdateDateColumn)({type:"timestamptz"}),t("design:type",Date)],n.prototype,"updated_at",void 0),e([(0,o.DeleteDateColumn)({type:"timestamptz"}),t("design:type",Date)],n.prototype,"deleted_at",void 0),exports.File=n=e([(0,o.Entity)("files"),(0,o.Index)("IDX_files",["id"],{where:"deleted_at IS NULL"}),(0,o.Index)("IDX_files_target_target_id",["target","target_id"]),(0,o.Index)("IDX_files_user_id",["user_id"])],n);
1
+ var e=this&&this.__decorate||function(e,t,o,n){var i,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(a=(r<3?i(a):r>3?i(t,o,a):i(t,o))||a);return r>3&&a&&Object.defineProperty(t,o,a),a},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.File=void 0;const o=require("typeorm"),n=require("../../enums.common");let i=class File{};exports.File=i,e([(0,o.PrimaryGeneratedColumn)({name:"id",primaryKeyConstraintName:"PK_files"}),t("design:type",Number)],i.prototype,"id",void 0),e([(0,o.Column)("enum",{enum:n.FILE_STATUS}),t("design:type",String)],i.prototype,"status",void 0),e([(0,o.Column)("enum",{enum:n.FILE_STORAGE_TYPE,default:n.FILE_STORAGE_TYPE.AWS}),t("design:type",String)],i.prototype,"storage_type",void 0),e([(0,o.Column)("varchar",{length:25}),t("design:type",String)],i.prototype,"target",void 0),e([(0,o.Column)("int"),t("design:type",Number)],i.prototype,"target_id",void 0),e([(0,o.Column)("int",{nullable:!0}),t("design:type",Number)],i.prototype,"user_id",void 0),e([(0,o.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],i.prototype,"original_name",void 0),e([(0,o.Column)("varchar",{length:255,comment:"object storage: UUID 기반 파일명, remote: file_url"}),t("design:type",String)],i.prototype,"file_name",void 0),e([(0,o.Column)("varchar",{length:255,comment:"object storage: [target]/[path:YYMMDD]/[file_name], remote: file_url"}),t("design:type",String)],i.prototype,"path",void 0),e([(0,o.Column)("varchar",{length:100,nullable:!0}),t("design:type",String)],i.prototype,"mime_type",void 0),e([(0,o.Column)("int",{nullable:!0}),t("design:type",Number)],i.prototype,"size",void 0),e([(0,o.Column)("jsonb",{nullable:!0}),t("design:type",Object)],i.prototype,"meta",void 0),e([(0,o.Column)("smallint",{default:0,comment:"0: cover, 1: details ..."}),t("design:type",Number)],i.prototype,"group_number",void 0),e([(0,o.Column)("int",{default:0}),t("design:type",Number)],i.prototype,"sort",void 0),e([(0,o.Column)("boolean",{default:!0}),t("design:type",Boolean)],i.prototype,"has_thumbnail",void 0),e([(0,o.Column)("boolean",{default:!0}),t("design:type",Boolean)],i.prototype,"is_active",void 0),e([(0,o.CreateDateColumn)({type:"timestamptz"}),t("design:type",Date)],i.prototype,"created_at",void 0),e([(0,o.UpdateDateColumn)({type:"timestamptz"}),t("design:type",Date)],i.prototype,"updated_at",void 0),e([(0,o.DeleteDateColumn)({type:"timestamptz"}),t("design:type",Date)],i.prototype,"deleted_at",void 0),exports.File=i=e([(0,o.Entity)("files"),(0,o.Index)("IDX_files",["id"],{where:"deleted_at IS NULL"}),(0,o.Index)("IDX_files_target_target_id",["target","target_id"]),(0,o.Index)("IDX_files_user_id",["user_id"])],i);
@@ -1 +1 @@
1
- var e=this&&this.__decorate||function(e,t,i,n){var o,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var p=e.length-1;p>=0;p--)(o=e[p])&&(r=(a<3?o(r):a>3?o(t,i,r):o(t,i))||r);return a>3&&r&&Object.defineProperty(t,i,r),r},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationRecipient=void 0;const i=require("typeorm"),n=require("../../enums.common"),o=require("./notification.entity");class Relations{}e([(0,i.ManyToOne)(()=>o.Notification,e=>e.recipients),(0,i.JoinColumn)({name:"notification_id",foreignKeyConstraintName:"FK_nrecipients_notification_id"}),t("design:type",o.Notification)],Relations.prototype,"notification",void 0);let a=class NotificationRecipient extends Relations{};exports.NotificationRecipient=a,e([(0,i.PrimaryGeneratedColumn)({name:"id",primaryKeyConstraintName:"PK_nrecipients"}),t("design:type",Number)],a.prototype,"id",void 0),e([(0,i.Column)("int"),t("design:type",Number)],a.prototype,"notification_id",void 0),e([(0,i.Column)("varchar",{length:25,nullable:!0}),t("design:type",String)],a.prototype,"type",void 0),e([(0,i.Column)("int"),t("design:type",Number)],a.prototype,"user_id",void 0),e([(0,i.Column)("varchar",{length:100,nullable:!0}),t("design:type",String)],a.prototype,"recipient",void 0),e([(0,i.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],a.prototype,"title",void 0),e([(0,i.Column)("text",{nullable:!0}),t("design:type",String)],a.prototype,"content",void 0),e([(0,i.Column)("jsonb",{nullable:!0}),t("design:type",Object)],a.prototype,"meta",void 0),e([(0,i.Column)("jsonb",{nullable:!0}),t("design:type",Object)],a.prototype,"variables",void 0),e([(0,i.Column)("enum",{enum:n.NOTIFICATION_STATUS}),t("design:type",String)],a.prototype,"status",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"sent_at",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"read_at",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"failed_at",void 0),e([(0,i.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],a.prototype,"reason_failed",void 0),e([(0,i.CreateDateColumn)({type:"timestamptz"}),t("design:type",Date)],a.prototype,"created_at",void 0),exports.NotificationRecipient=a=e([(0,i.Entity)("notification_recipients"),(0,i.Index)("IDX_nrecipients_notification_id_status",["notification_id","status"]),(0,i.Index)("IDX_nrecipients_user_id",["user_id"]),(0,i.Index)("IDX_nrecipients_type",["type"])],a);
1
+ var e=this&&this.__decorate||function(e,t,i,n){var o,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var p=e.length-1;p>=0;p--)(o=e[p])&&(r=(a<3?o(r):a>3?o(t,i,r):o(t,i))||r);return a>3&&r&&Object.defineProperty(t,i,r),r},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationRecipient=void 0;const i=require("typeorm"),n=require("../../enums.common"),o=require("./notification.entity");class Relations{}e([(0,i.ManyToOne)(()=>o.Notification,e=>e.recipients),(0,i.JoinColumn)({name:"notification_id",foreignKeyConstraintName:"FK_nrecipients_notification_id"}),t("design:type",o.Notification)],Relations.prototype,"notification",void 0);let a=class NotificationRecipient extends Relations{};exports.NotificationRecipient=a,e([(0,i.PrimaryGeneratedColumn)({name:"id",primaryKeyConstraintName:"PK_nrecipients"}),t("design:type",Number)],a.prototype,"id",void 0),e([(0,i.Column)("int"),t("design:type",Number)],a.prototype,"notification_id",void 0),e([(0,i.Column)("varchar",{length:25,nullable:!0}),t("design:type",String)],a.prototype,"type",void 0),e([(0,i.Column)("int",{nullable:!0}),t("design:type",Number)],a.prototype,"user_id",void 0),e([(0,i.Column)("varchar",{length:100,nullable:!0}),t("design:type",String)],a.prototype,"recipient",void 0),e([(0,i.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],a.prototype,"title",void 0),e([(0,i.Column)("text",{nullable:!0}),t("design:type",String)],a.prototype,"content",void 0),e([(0,i.Column)("jsonb",{nullable:!0}),t("design:type",Object)],a.prototype,"meta",void 0),e([(0,i.Column)("jsonb",{nullable:!0}),t("design:type",Object)],a.prototype,"variables",void 0),e([(0,i.Column)("enum",{enum:n.NOTIFICATION_STATUS}),t("design:type",String)],a.prototype,"status",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"sent_at",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"read_at",void 0),e([(0,i.Column)("timestamptz",{nullable:!0}),t("design:type",Date)],a.prototype,"failed_at",void 0),e([(0,i.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],a.prototype,"reason_failed",void 0),e([(0,i.CreateDateColumn)({type:"timestamptz"}),t("design:type",Date)],a.prototype,"created_at",void 0),exports.NotificationRecipient=a=e([(0,i.Entity)("notification_recipients"),(0,i.Index)("IDX_nrecipients_notification_id_status",["notification_id","status"]),(0,i.Index)("IDX_nrecipients_user_id",["user_id"]),(0,i.Index)("IDX_nrecipients_type",["type"])],a);
@@ -1,6 +1,9 @@
1
1
  declare class FileMetaDto {
2
2
  width?: number;
3
3
  height?: number;
4
+ orientation?: number;
5
+ duration?: number;
6
+ encoding?: string;
4
7
  }
5
8
  export declare class FileDto {
6
9
  id: number;
@@ -1 +1 @@
1
- var e=this&&this.__decorate||function(e,t,o,i){var r,s=arguments.length,l=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var p=e.length-1;p>=0;p--)(r=e[p])&&(l=(s<3?r(l):s>3?r(t,o,l):r(t,o))||l);return s>3&&l&&Object.defineProperty(t,o,l),l},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileThumbnailDto=exports.FileDto=void 0;const o=require("@nestjs/swagger"),i=require("class-transformer");class FileMetaDto{}e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"width",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"height",void 0);class FileDto{}exports.FileDto=FileDto,e([(0,i.Expose)(),t("design:type",Number)],FileDto.prototype,"id",void 0),e([(0,i.Expose)(),t("design:type",String)],FileDto.prototype,"original_name",void 0),e([(0,i.Expose)(),t("design:type",String)],FileDto.prototype,"mime_type",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileDto.prototype,"size",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>`${process.env.CDN_URL||""}/uploads/${e.target}/${e.path}/${e.file_name}`),t("design:type",String)],FileDto.prototype,"full_url",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>{var t;return(null===(t=e.mime_type)||void 0===t?void 0:t.startsWith("image/"))?`${process.env.CDN_URL||""}/thumbnails/${e.target}/${e.path}/sm/${e.file_name}`:void 0}),t("design:type",String)],FileDto.prototype,"thumbnail_small",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>{var t;return(null===(t=e.mime_type)||void 0===t?void 0:t.startsWith("image/"))?`${process.env.CDN_URL||""}/thumbnails/${e.target}/${e.path}/md/${e.file_name}`:void 0}),t("design:type",String)],FileDto.prototype,"thumbnail_medium",void 0),e([(0,i.Expose)(),(0,i.Type)(()=>FileMetaDto),(0,i.Transform)(({obj:e})=>e.meta),t("design:type",FileMetaDto)],FileDto.prototype,"meta",void 0);class FileThumbnailDto extends((0,o.PickType)(FileDto,["thumbnail_small","thumbnail_medium"])){}exports.FileThumbnailDto=FileThumbnailDto;
1
+ var e=this&&this.__decorate||function(e,t,o,i){var r,p=arguments.length,s=p<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(s=(p<3?r(s):p>3?r(t,o,s):r(t,o))||s);return p>3&&s&&Object.defineProperty(t,o,s),s},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.FileThumbnailDto=exports.FileDto=void 0;const o=require("@nestjs/swagger"),i=require("class-transformer");class FileMetaDto{}e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"width",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"height",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"orientation",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileMetaDto.prototype,"duration",void 0),e([(0,i.Expose)(),t("design:type",String)],FileMetaDto.prototype,"encoding",void 0);class FileDto{}exports.FileDto=FileDto,e([(0,i.Expose)(),t("design:type",Number)],FileDto.prototype,"id",void 0),e([(0,i.Expose)(),t("design:type",String)],FileDto.prototype,"original_name",void 0),e([(0,i.Expose)(),t("design:type",String)],FileDto.prototype,"mime_type",void 0),e([(0,i.Expose)(),t("design:type",Number)],FileDto.prototype,"size",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>`${process.env.CDN_URL||""}/uploads/${e.target}/${e.path}/${e.file_name}`),t("design:type",String)],FileDto.prototype,"full_url",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>{var t;return(null===(t=e.mime_type)||void 0===t?void 0:t.startsWith("image/"))?`${process.env.CDN_URL||""}/thumbnails/${e.target}/${e.path}/sm/${e.file_name}`:void 0}),t("design:type",String)],FileDto.prototype,"thumbnail_small",void 0),e([(0,i.Expose)(),(0,i.Transform)(({obj:e})=>{var t;return(null===(t=e.mime_type)||void 0===t?void 0:t.startsWith("image/"))?`${process.env.CDN_URL||""}/thumbnails/${e.target}/${e.path}/md/${e.file_name}`:void 0}),t("design:type",String)],FileDto.prototype,"thumbnail_medium",void 0),e([(0,i.Expose)(),(0,i.Type)(()=>FileMetaDto),(0,i.Transform)(({obj:e})=>e.meta),t("design:type",FileMetaDto)],FileDto.prototype,"meta",void 0);class FileThumbnailDto extends((0,o.PickType)(FileDto,["thumbnail_small","thumbnail_medium"])){}exports.FileThumbnailDto=FileThumbnailDto;
@@ -40,6 +40,13 @@ export declare enum FILE_STATUS {
40
40
  FAILED = "failed",
41
41
  DELETED = "deleted"
42
42
  }
43
+ export declare enum FILE_STORAGE_TYPE {
44
+ AWS = "aws",
45
+ NCP = "ncp",
46
+ REMOTE = "remote",
47
+ LOCAL = "local",
48
+ OTHER = "other"
49
+ }
43
50
  export declare enum NOTIFICATION_STATUS {
44
51
  PENDING = "pending",
45
52
  SENT = "sent",
@@ -1 +1 @@
1
- var e,o,t,n,E,p,i;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LIKE_TYPE=exports.NOTIFICATION_STATUS=exports.FILE_STATUS=exports.AUDIT_ACTION=exports.DEVICE_TYPE=exports.MIME_TYPE=exports.FILE_TYPE=void 0,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.AUDIO="AUDIO",e.OTHER="OTHER"}(e||(exports.FILE_TYPE=e={})),function(e){e.JPEG="image/jpeg",e.PNG="image/png",e.GIF="image/gif",e.PDF="application/pdf",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.TXT="text/plain",e.HTML="text/html",e.CSV="text/csv"}(o||(exports.MIME_TYPE=o={})),function(e){e.ANDROID="android",e.IOS="ios",e.PC="pc",e.MAC="mac",e.OTHER="other"}(t||(exports.DEVICE_TYPE=t={})),function(e){e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.DOWNLOAD="download"}(n||(exports.AUDIT_ACTION=n={})),function(e){e.PENDING="pending",e.COMPLETED="completed",e.FAILED="failed",e.DELETED="deleted"}(E||(exports.FILE_STATUS=E={})),function(e){e.PENDING="pending",e.SENT="sent",e.READ="read",e.FAILED="failed"}(p||(exports.NOTIFICATION_STATUS=p={})),function(e){e.LIKE="like",e.DISLIKE="dislike",e.NONE="none"}(i||(exports.LIKE_TYPE=i={}));
1
+ var e,o,t,E,n,p,T,i;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LIKE_TYPE=exports.NOTIFICATION_STATUS=exports.FILE_STORAGE_TYPE=exports.FILE_STATUS=exports.AUDIT_ACTION=exports.DEVICE_TYPE=exports.MIME_TYPE=exports.FILE_TYPE=void 0,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.AUDIO="AUDIO",e.OTHER="OTHER"}(e||(exports.FILE_TYPE=e={})),function(e){e.JPEG="image/jpeg",e.PNG="image/png",e.GIF="image/gif",e.PDF="application/pdf",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.TXT="text/plain",e.HTML="text/html",e.CSV="text/csv"}(o||(exports.MIME_TYPE=o={})),function(e){e.ANDROID="android",e.IOS="ios",e.PC="pc",e.MAC="mac",e.OTHER="other"}(t||(exports.DEVICE_TYPE=t={})),function(e){e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.DOWNLOAD="download"}(E||(exports.AUDIT_ACTION=E={})),function(e){e.PENDING="pending",e.COMPLETED="completed",e.FAILED="failed",e.DELETED="deleted"}(n||(exports.FILE_STATUS=n={})),function(e){e.AWS="aws",e.NCP="ncp",e.REMOTE="remote",e.LOCAL="local",e.OTHER="other"}(p||(exports.FILE_STORAGE_TYPE=p={})),function(e){e.PENDING="pending",e.SENT="sent",e.READ="read",e.FAILED="failed"}(T||(exports.NOTIFICATION_STATUS=T={})),function(e){e.LIKE="like",e.DISLIKE="dislike",e.NONE="none"}(i||(exports.LIKE_TYPE=i={}));
@@ -1 +1,2 @@
1
1
  export * from './http-exception.filter';
2
+ export * from './validation-exception.filter';
@@ -1 +1 @@
1
- var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./http-exception.filter"),exports);
1
+ var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./http-exception.filter"),exports),t(require("./validation-exception.filter"),exports);
@@ -0,0 +1,8 @@
1
+ import { ArgumentsHost, ExceptionFilter, UnprocessableEntityException } from '@nestjs/common';
2
+ export declare class ValidationExceptionFilter implements ExceptionFilter {
3
+ catch(exception: UnprocessableEntityException, host: ArgumentsHost): void;
4
+ private flattenValidationErrors;
5
+ private parseStringError;
6
+ private formatValidationErrors;
7
+ private constraintKeyToErrorCode;
8
+ }
@@ -0,0 +1 @@
1
+ var e=this&&this.__decorate||function(e,t,i,s){var r,I=arguments.length,n=I<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(n=(I<3?r(n):I>3?r(t,i,n):r(t,i))||n);return I>3&&n&&Object.defineProperty(t,i,n),n};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ValidationExceptionFilter=void 0;const t=require("@nestjs/common");let i=class ValidationExceptionFilter{catch(e,t){const i=t.switchToHttp(),s=i.getResponse(),r=e.getResponse(),I=this.flattenValidationErrors(r.message);s.status(422).json({success:!1,status:422,path:i.getRequest().url,errors:I})}flattenValidationErrors(e){return Array.isArray(e)&&0===e.length?[{field:"unknown",code:"VALIDATION_ERROR",message:"Validation failed"}]:Array.isArray(e)&&e.length>0&&"string"==typeof e[0]?e.map(e=>this.parseStringError(e)):Array.isArray(e)&&e.length>0&&"object"==typeof e[0]?this.formatValidationErrors(e):"string"==typeof e?[{field:"unknown",code:"VALIDATION_ERROR",message:e}]:[{field:"unknown",code:"VALIDATION_ERROR",message:"Validation failed"}]}parseStringError(e){const t=e.trim().split(" ")[0];return{field:/^[a-z_][a-z0-9_]*$/i.test(t)?t:"unknown",code:"VALIDATION_ERROR",message:e}}formatValidationErrors(e,t=""){const i=[];for(const s of e){const e=t?`${t}.${s.property}`:s.property;if(s.constraints)for(const[t,r]of Object.entries(s.constraints))i.push({field:e,code:this.constraintKeyToErrorCode(t),message:r});if(s.children&&s.children.length>0){const t=this.formatValidationErrors(s.children,e);i.push(...t)}}return i}constraintKeyToErrorCode(e){return{isNotEmpty:"REQUIRED",isDefined:"REQUIRED",isOptional:"OPTIONAL",isEmail:"INVALID_EMAIL",isUrl:"INVALID_URL",isUUID:"INVALID_UUID",isPhoneNumber:"INVALID_PHONE",isISO8601:"INVALID_DATE_FORMAT",isMongoId:"INVALID_MONGO_ID",isJWT:"INVALID_JWT",isHexadecimal:"INVALID_HEX",isHash:"INVALID_HASH",isAlpha:"INVALID_ALPHA",isAlphanumeric:"INVALID_ALPHANUMERIC",isAscii:"INVALID_ASCII",isBase64:"INVALID_BASE64",isJSON:"INVALID_JSON",isLowercase:"INVALID_LOWERCASE",isUppercase:"INVALID_UPPERCASE",isCreditCard:"INVALID_CREDIT_CARD",isCurrency:"INVALID_CURRENCY",isDecimal:"INVALID_DECIMAL",isIP:"INVALID_IP",isPort:"INVALID_PORT",isMACAddress:"INVALID_MAC_ADDRESS",isMimeType:"INVALID_MIME_TYPE",isLatLong:"INVALID_LAT_LONG",isLocale:"INVALID_LOCALE",minLength:"MIN_LENGTH",maxLength:"MAX_LENGTH",length:"INVALID_LENGTH",matches:"PATTERN_MISMATCH",contains:"MUST_CONTAIN",notContains:"MUST_NOT_CONTAIN",min:"MIN_VALUE",max:"MAX_VALUE",isPositive:"MUST_BE_POSITIVE",isNegative:"MUST_BE_NEGATIVE",isDivisibleBy:"DIVISIBLE_BY",isString:"INVALID_TYPE_STRING",isNumber:"INVALID_TYPE_NUMBER",isInt:"INVALID_TYPE_INTEGER",isBoolean:"INVALID_TYPE_BOOLEAN",isArray:"INVALID_TYPE_ARRAY",isObject:"INVALID_TYPE_OBJECT",isDate:"INVALID_TYPE_DATE",isInstance:"INVALID_TYPE_INSTANCE",arrayMinSize:"ARRAY_MIN_SIZE",arrayMaxSize:"ARRAY_MAX_SIZE",arrayUnique:"ARRAY_UNIQUE",arrayNotEmpty:"ARRAY_NOT_EMPTY",arrayContains:"ARRAY_MUST_CONTAIN",arrayNotContains:"ARRAY_MUST_NOT_CONTAIN",isEnum:"INVALID_ENUM",isIn:"INVALID_VALUE",isNotIn:"INVALID_VALUE",equals:"MUST_EQUAL",notEquals:"MUST_NOT_EQUAL",whitelistValidation:"INVALID_PROPERTY",isNotEmptyObject:"REQUIRED_OBJECT",minDate:"MIN_DATE",maxDate:"MAX_DATE"}[e]||e.toUpperCase()}};exports.ValidationExceptionFilter=i,exports.ValidationExceptionFilter=i=e([(0,t.Catch)(t.UnprocessableEntityException)],i);
@@ -2,6 +2,7 @@ import { ConfigService } from '@nestjs/config';
2
2
  export declare class EmailService {
3
3
  private readonly configService;
4
4
  private sesClient;
5
+ private resendClient;
5
6
  constructor(configService: ConfigService);
6
7
  send(recipients: Array<{
7
8
  recipient: string;
@@ -15,7 +16,7 @@ export declare class EmailService {
15
16
  success: boolean;
16
17
  content: string;
17
18
  status: string;
18
- }[] | import("@aws-sdk/client-ses").SendEmailCommandOutput>;
19
+ }[] | import("@aws-sdk/client-ses").SendEmailCommandOutput | import("resend").CreateEmailResponse>;
19
20
  sendAws(recipients: Array<{
20
21
  recipient: string;
21
22
  user_id: number;
@@ -29,4 +30,17 @@ export declare class EmailService {
29
30
  content: string;
30
31
  status: string;
31
32
  }[] | import("@aws-sdk/client-ses").SendEmailCommandOutput>;
33
+ sendResend(recipients: Array<{
34
+ recipient: string;
35
+ user_id: number;
36
+ subject: string;
37
+ text: string;
38
+ variables?: Record<string, any>;
39
+ }>): Promise<{
40
+ user_id: number;
41
+ recipient: string;
42
+ success: boolean;
43
+ content: string;
44
+ status: string;
45
+ }[] | import("resend").CreateEmailResponse>;
32
46
  }
@@ -1 +1 @@
1
- var e=this&&this.__decorate||function(e,t,i,n){var s,r=arguments.length,c=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(c=(r<3?s(c):r>3?s(t,i,c):s(t,i))||c);return r>3&&c&&Object.defineProperty(t,i,c),c},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(s,r){function fulfilled(e){try{step(n.next(e))}catch(e){r(e)}}function rejected(e){try{step(n.throw(e))}catch(e){r(e)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmailService=void 0;const n=require("@aws-sdk/client-ses"),s=require("@nestjs/common"),r=require("@nestjs/config");let c=class EmailService{constructor(e){this.configService=e,"aws"===this.configService.get("EMAIL_PROVIDER")&&(this.sesClient=new n.SESClient({region:this.configService.get("AWS_REGION"),credentials:{accessKeyId:this.configService.get("AWS_ACCESS_KEY_ID"),secretAccessKey:this.configService.get("AWS_SECRET_ACCESS_KEY")}}))}send(e){return i(this,void 0,void 0,function*(){const t=this.configService.get("EMAIL_PROVIDER");if(!t||!this.configService.get("EMAIL_FROM"))throw new Error("EMAIL_PROVIDER or EMAIL_FROM is not set");return"aws"===t?this.sendAws(e):[]})}sendAws(e){return i(this,void 0,void 0,function*(){if("production"!==process.env.NODE_ENV)return e.map(e=>({user_id:e.user_id,recipient:e.recipient,success:!0,content:e.text,status:"sent"}));for(const t of e){const e=new n.SendEmailCommand({Source:this.configService.get("EMAIL_NOREPLY_SOURCE"),Destination:{ToAddresses:[t.recipient]},Message:{Subject:{Data:t.subject,Charset:"UTF-8"},Body:{Html:{Data:t.text,Charset:"UTF-8"}}}});return yield this.sesClient.send(e)}})}};exports.EmailService=c,exports.EmailService=c=e([(0,s.Injectable)(),t("design:paramtypes",[r.ConfigService])],c);
1
+ var e=this&&this.__decorate||function(e,t,i,n){var s,r=arguments.length,c=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(c=(r<3?s(c):r>3?s(t,i,c):s(t,i))||c);return r>3&&c&&Object.defineProperty(t,i,c),c},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(s,r){function fulfilled(e){try{step(n.next(e))}catch(e){r(e)}}function rejected(e){try{step(n.throw(e))}catch(e){r(e)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmailService=void 0;const n=require("@aws-sdk/client-ses"),s=require("@nestjs/common"),r=require("@nestjs/config"),c=require("resend");let o=class EmailService{constructor(e){this.configService=e,"aws"===this.configService.get("EMAIL_PROVIDER")&&(this.sesClient=new n.SESClient({region:this.configService.get("AWS_REGION"),credentials:{accessKeyId:this.configService.get("AWS_ACCESS_KEY_ID"),secretAccessKey:this.configService.get("AWS_SECRET_ACCESS_KEY")}})),"resend"===this.configService.get("EMAIL_PROVIDER")&&(this.resendClient=new c.Resend(this.configService.get("RESEND_API_KEY")))}send(e){return i(this,void 0,void 0,function*(){const t=this.configService.get("EMAIL_PROVIDER");if(!t||!this.configService.get("EMAIL_FROM"))throw new Error("EMAIL_PROVIDER or EMAIL_FROM is not set");return"aws"===t?this.sendAws(e):"resend"===t?this.sendResend(e):[]})}sendAws(e){return i(this,void 0,void 0,function*(){if("production"!==process.env.NODE_ENV)return e.map(e=>({user_id:e.user_id,recipient:e.recipient,success:!0,content:e.text,status:"sent"}));for(const t of e){const e=new n.SendEmailCommand({Source:this.configService.get("EMAIL_NOREPLY_SOURCE"),Destination:{ToAddresses:[t.recipient]},Message:{Subject:{Data:t.subject,Charset:"UTF-8"},Body:{Html:{Data:t.text,Charset:"UTF-8"}}}});return yield this.sesClient.send(e)}})}sendResend(e){return i(this,void 0,void 0,function*(){if("production"!==process.env.NODE_ENV)return console.log("📧 [EMAIL] Resend 배열 발송:",{count:e.length,from:this.configService.get("EMAIL_FROM"),provider:this.configService.get("EMAIL_PROVIDER"),recipients:e.map(e=>({user_id:e.user_id,recipient:e.recipient,subject:e.subject,text:e.text.substring(0,50)+(e.text.length>50?"...":""),variables:e.variables})),timestamp:(new Date).toISOString()}),e.map(e=>({user_id:e.user_id,recipient:e.recipient,success:!0,content:e.text,status:"sent"}));for(const t of e){return yield this.resendClient.emails.send({from:this.configService.get("EMAIL_NOREPLY_SOURCE"),to:[t.recipient],subject:t.subject,html:t.text})}})}};exports.EmailService=o,exports.EmailService=o=e([(0,s.Injectable)(),t("design:paramtypes",[r.ConfigService])],o);
@@ -15,7 +15,7 @@ export declare class NotificationSendService {
15
15
  private readonly messageTemplateService;
16
16
  private readonly dataSource;
17
17
  constructor(emailService: EmailService, smsService: SmsService, kakaoService: KakaoService, slackService: SlackService, webNotificationService: WebNotificationService, messageTemplateService: MessageTemplateService, dataSource: DataSource);
18
- send(payload: NotificationPayload): Promise<any[] | import("@aws-sdk/client-ses").SendEmailCommandOutput | {
18
+ send(payload: NotificationPayload): Promise<any[] | import("@aws-sdk/client-ses").SendEmailCommandOutput | import("resend").CreateEmailResponse | {
19
19
  success: boolean;
20
20
  }>;
21
21
  private sendWeb;
@@ -1 +1 @@
1
- var e=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(a,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i.throw(e))}catch(e){o(e)}}function step(e){e.done?a(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.paginate=function paginate(t,n){return e(this,void 0,void 0,function*(){const{page:e,limit:i}=n,a=t.connection.createQueryBuilder().select("COUNT(*)","count").from(`(${t.getQuery()})`,"subquery").setParameters(t.getParameters()),[o,r]=yield Promise.all([t.skip((e-1)*i).take(i).getMany(),a.getRawOne().then(e=>parseInt(e.count))]),u=Math.ceil(r/i);return{items:o,pagination:{page:e,limit:i,count:o.length,count_total:r,count_page:u}}})};
1
+ var t=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(o,a){function fulfilled(t){try{step(i.next(t))}catch(t){a(t)}}function rejected(t){try{step(i.throw(t))}catch(t){a(t)}}function step(t){t.done?o(t.value):function adopt(t){return t instanceof n?t:new n(function(e){e(t)})}(t.value).then(fulfilled,rejected)}step((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.paginate=function paginate(e,n){return t(this,void 0,void 0,function*(){const{page:t,limit:i}=n,o=e.clone(),[a,c]=yield Promise.all([e.skip((t-1)*i).take(i).getMany(),o.getCount()]),u=Math.ceil(c/i);return{items:a,pagination:{page:t,limit:i,count:a.length,count_total:c,count_page:u}}})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comasoft/nestjs",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "exports": {
@@ -43,6 +43,7 @@
43
43
  "passport-kakao": "1.0.1",
44
44
  "passport-local": "1.0.0",
45
45
  "pino-pretty": "^13.0.0",
46
+ "resend": "^6.4.1",
46
47
  "ua-parser-js": "^2.0.3"
47
48
  },
48
49
  "devDependencies": {