133 lines
3.7 KiB
JavaScript
133 lines
3.7 KiB
JavaScript
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 { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from "typeorm";
|
|
import { User } from "./user.js";
|
|
import { App } from "./app.js";
|
|
import { id } from "../id.js";
|
|
export let AccessToken = class AccessToken {
|
|
id;
|
|
createdAt;
|
|
lastUsedAt;
|
|
token;
|
|
session;
|
|
hash;
|
|
userId;
|
|
user;
|
|
appId;
|
|
app;
|
|
name;
|
|
description;
|
|
iconUrl;
|
|
permission;
|
|
fetched;
|
|
};
|
|
_ts_decorate([
|
|
PrimaryColumn(id()),
|
|
_ts_metadata("design:type", String)
|
|
], AccessToken.prototype, "id", void 0);
|
|
_ts_decorate([
|
|
Column("timestamp with time zone", {
|
|
comment: "The created date of the AccessToken."
|
|
}),
|
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
], AccessToken.prototype, "createdAt", void 0);
|
|
_ts_decorate([
|
|
Column("timestamp with time zone", {
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "lastUsedAt", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column("varchar", {
|
|
length: 128
|
|
}),
|
|
_ts_metadata("design:type", String)
|
|
], AccessToken.prototype, "token", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column("varchar", {
|
|
length: 128,
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "session", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column("varchar", {
|
|
length: 128
|
|
}),
|
|
_ts_metadata("design:type", String)
|
|
], AccessToken.prototype, "hash", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column(id()),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "userId", void 0);
|
|
_ts_decorate([
|
|
ManyToOne((type)=>User, {
|
|
onDelete: "CASCADE"
|
|
}),
|
|
JoinColumn(),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "user", void 0);
|
|
_ts_decorate([
|
|
Column({
|
|
...id(),
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "appId", void 0);
|
|
_ts_decorate([
|
|
ManyToOne((type)=>App, {
|
|
onDelete: "CASCADE"
|
|
}),
|
|
JoinColumn(),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "app", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 128,
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "name", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 512,
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "description", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 512,
|
|
nullable: true
|
|
}),
|
|
_ts_metadata("design:type", Object)
|
|
], AccessToken.prototype, "iconUrl", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 64,
|
|
array: true,
|
|
default: "{}"
|
|
}),
|
|
_ts_metadata("design:type", Array)
|
|
], AccessToken.prototype, "permission", void 0);
|
|
_ts_decorate([
|
|
Column("boolean", {
|
|
default: false
|
|
}),
|
|
_ts_metadata("design:type", Boolean)
|
|
], AccessToken.prototype, "fetched", void 0);
|
|
AccessToken = _ts_decorate([
|
|
Entity()
|
|
], AccessToken);
|