Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
function _ts_decorate(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;
|
||||
}
|
||||
function _ts_metadata(k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
}
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from "typeorm";
|
||||
import { id } from "../id.js";
|
||||
import { Note } from "./note.js";
|
||||
import { noteVisibilities } from "../../types.js";
|
||||
export let Poll = class Poll {
|
||||
noteId;
|
||||
note;
|
||||
expiresAt;
|
||||
multiple;
|
||||
choices;
|
||||
votes;
|
||||
//#region Denormalized fields
|
||||
noteVisibility;
|
||||
userId;
|
||||
userHost;
|
||||
//#endregion
|
||||
constructor(data){
|
||||
if (data == null) return;
|
||||
for (const [k, v] of Object.entries(data)){
|
||||
this[k] = v;
|
||||
}
|
||||
}
|
||||
};
|
||||
_ts_decorate([
|
||||
PrimaryColumn(id()),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "noteId", void 0);
|
||||
_ts_decorate([
|
||||
OneToOne((type)=>Note, {
|
||||
onDelete: "CASCADE"
|
||||
}),
|
||||
JoinColumn(),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "note", void 0);
|
||||
_ts_decorate([
|
||||
Column("timestamp with time zone", {
|
||||
nullable: true
|
||||
}),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "expiresAt", void 0);
|
||||
_ts_decorate([
|
||||
Column("boolean"),
|
||||
_ts_metadata("design:type", Boolean)
|
||||
], Poll.prototype, "multiple", void 0);
|
||||
_ts_decorate([
|
||||
Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}"
|
||||
}),
|
||||
_ts_metadata("design:type", Array)
|
||||
], Poll.prototype, "choices", void 0);
|
||||
_ts_decorate([
|
||||
Column("integer", {
|
||||
array: true
|
||||
}),
|
||||
_ts_metadata("design:type", Array)
|
||||
], Poll.prototype, "votes", void 0);
|
||||
_ts_decorate([
|
||||
Column("enum", {
|
||||
enum: noteVisibilities,
|
||||
comment: "[Denormalized]"
|
||||
}),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "noteVisibility", void 0);
|
||||
_ts_decorate([
|
||||
Index(),
|
||||
Column({
|
||||
...id(),
|
||||
comment: "[Denormalized]"
|
||||
}),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "userId", void 0);
|
||||
_ts_decorate([
|
||||
Index(),
|
||||
Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]"
|
||||
}),
|
||||
_ts_metadata("design:type", Object)
|
||||
], Poll.prototype, "userHost", void 0);
|
||||
Poll = _ts_decorate([
|
||||
Entity(),
|
||||
_ts_metadata("design:type", Function),
|
||||
_ts_metadata("design:paramtypes", [
|
||||
typeof Partial === "undefined" ? Object : Partial
|
||||
])
|
||||
], Poll);
|
||||
Reference in New Issue
Block a user