summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/App.ts
blob: 0185e2995c864096cdc6639ee9f8e7f3cce1c0ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm';
import { id } from './util/id.js';
import { MiUser } from './User.js';

@Entity('app')
export class MiApp {
	@PrimaryColumn(id())
	public id: string;

	@Index()
	@Column({
		...id(),
		nullable: true,
		comment: 'The owner ID.',
	})
	public userId: MiUser['id'] | null;

	@ManyToOne(type => MiUser, {
		onDelete: 'SET NULL',
		nullable: true,
	})
	public user: MiUser | null;

	@Index()
	@Column('varchar', {
		length: 64,
		comment: 'The secret key of the App.',
	})
	public secret: string;

	@Column('varchar', {
		length: 128,
		comment: 'The name of the App.',
	})
	public name: string;

	@Column('varchar', {
		length: 512,
		comment: 'The description of the App.',
	})
	public description: string;

	@Column('varchar', {
		length: 64, array: true,
		comment: 'The permission of the App.',
	})
	public permission: string[];

	@Column('varchar', {
		length: 512, nullable: true,
		comment: 'The callbackUrl of the App.',
	})
	public callbackUrl: string | null;
}