@nx-ddd/common
TypeScript icon, indicating that this package has built-in type declarations

16.3.1 • Public • Published

NxDDD Common

@nx-ddd/common is a library used for domain model annotations and related functionalities.

Install

$ npm i @nx-ddd/common

Usage

import { Domain, getAnnotations, getLangMap, getModelName } from './models';

@Domain.Entity({name: 'Profile'})
class Profile {
  @Domain.Lang('名前') name: string;
  @Domain.Lang('メールアドレス') email: string;
}

@Domain.Entity({name: 'ユーザー'})
class User {
  @Domain.Lang('ID') id: string;
  @Domain.Type() profile: Profile;
  @Domain.Lang('作成日時') createdAt: Date;
  @Domain.Lang('更新日時') updatedAt: Date;
}

getLangMap(User);
/**
-> {
  id: 'ID',
  'profile.name': '名前',
  'profile.email': 'メールアドレス',
  createdAt: '作成日時',
  updatedAt: '更新日時',
}
 * */

getModelName(User) // -> 'ユーザー'

Readme

Keywords

none

Package Sidebar

Install

npm i @nx-ddd/common

Weekly Downloads

1

Version

16.3.1

License

none

Unpacked Size

70.1 kB

Total Files

74

Last publish

Collaborators

  • machina-owner
  • nontan