99 lines
3.1 KiB
JavaScript
99 lines
3.1 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, Column, Index, ManyToOne, JoinColumn } from "typeorm";
|
|
import { id } from "../id.js";
|
|
import { OAuthApp } from "./oauth-app.js";
|
|
import { User } from "./user.js";
|
|
export let OAuthToken = class OAuthToken {
|
|
id;
|
|
createdAt;
|
|
appId;
|
|
app;
|
|
userId;
|
|
user;
|
|
code;
|
|
token;
|
|
active;
|
|
scopes;
|
|
redirectUri;
|
|
};
|
|
_ts_decorate([
|
|
PrimaryColumn(id()),
|
|
_ts_metadata("design:type", String)
|
|
], OAuthToken.prototype, "id", void 0);
|
|
_ts_decorate([
|
|
Column("timestamp with time zone", {
|
|
comment: "The created date of the OAuth token"
|
|
}),
|
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
], OAuthToken.prototype, "createdAt", void 0);
|
|
_ts_decorate([
|
|
Column(id()),
|
|
_ts_metadata("design:type", Object)
|
|
], OAuthToken.prototype, "appId", void 0);
|
|
_ts_decorate([
|
|
ManyToOne(()=>OAuthApp, {
|
|
onDelete: "CASCADE"
|
|
}),
|
|
JoinColumn(),
|
|
_ts_metadata("design:type", typeof OAuthApp === "undefined" ? Object : OAuthApp)
|
|
], OAuthToken.prototype, "app", void 0);
|
|
_ts_decorate([
|
|
Column(id()),
|
|
_ts_metadata("design:type", Object)
|
|
], OAuthToken.prototype, "userId", void 0);
|
|
_ts_decorate([
|
|
ManyToOne(()=>User, {
|
|
onDelete: "CASCADE"
|
|
}),
|
|
JoinColumn(),
|
|
_ts_metadata("design:type", typeof User === "undefined" ? Object : User)
|
|
], OAuthToken.prototype, "user", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column("varchar", {
|
|
length: 64,
|
|
comment: "The auth code for the OAuth token"
|
|
}),
|
|
_ts_metadata("design:type", String)
|
|
], OAuthToken.prototype, "code", void 0);
|
|
_ts_decorate([
|
|
Index(),
|
|
Column("varchar", {
|
|
length: 64,
|
|
comment: "The OAuth token"
|
|
}),
|
|
_ts_metadata("design:type", String)
|
|
], OAuthToken.prototype, "token", void 0);
|
|
_ts_decorate([
|
|
Column("boolean", {
|
|
comment: "Whether or not the token has been activated"
|
|
}),
|
|
_ts_metadata("design:type", Boolean)
|
|
], OAuthToken.prototype, "active", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 64,
|
|
array: true,
|
|
comment: "The scopes requested by the OAuth token"
|
|
}),
|
|
_ts_metadata("design:type", Array)
|
|
], OAuthToken.prototype, "scopes", void 0);
|
|
_ts_decorate([
|
|
Column("varchar", {
|
|
length: 512,
|
|
comment: "The redirect URI of the OAuth token"
|
|
}),
|
|
_ts_metadata("design:type", String)
|
|
], OAuthToken.prototype, "redirectUri", void 0);
|
|
OAuthToken = _ts_decorate([
|
|
Entity('oauth_token')
|
|
], OAuthToken);
|