dynolink
Version:
A TypeScript ORM for DynamoDB
56 lines (55 loc) • 2.11 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.User = void 0;
// src/models/user.entity.ts
const decorators_1 = require("../../core/decorators");
let User = class User {
};
exports.User = User;
__decorate([
(0, decorators_1.PartitionKey)(),
(0, decorators_1.Column)(),
__metadata("design:type", String)
], User.prototype, "id", void 0);
__decorate([
(0, decorators_1.SortKey)(),
(0, decorators_1.Column)(),
__metadata("design:type", String)
], User.prototype, "name", void 0);
__decorate([
(0, decorators_1.Column)({ type: 'S' }),
(0, decorators_1.GSI)({
name: 'email-idx',
partitionKey: 'email',
projection: { ProjectionType: 'ALL' },
}),
__metadata("design:type", String)
], User.prototype, "email", void 0);
__decorate([
(0, decorators_1.Column)(),
(0, decorators_1.LSI)({
name: 'status-idx',
sortKey: 'status',
projection: { ProjectionType: 'ALL' },
}),
__metadata("design:type", String)
], User.prototype, "status", void 0);
__decorate([
(0, decorators_1.Column)({
type: 'S',
defaultValue: () => new Date().toISOString(),
}),
__metadata("design:type", String)
], User.prototype, "createdAt", void 0);
exports.User = User = __decorate([
(0, decorators_1.Table)("User")
], User);