add report admin panel
All checks were successful
delpoy / build-and-deploy (push) Successful in 53s
All checks were successful
delpoy / build-and-deploy (push) Successful in 53s
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
export let id: string | null = null;
|
||||
export let name: string | null = null;
|
||||
export let type: string;
|
||||
export let type = 'text';
|
||||
export let value: string | null = null;
|
||||
export let placeholder: string | null = null;
|
||||
export let required = false;
|
||||
|
@ -1,7 +1,9 @@
|
||||
<script lang="ts">
|
||||
export let id: string;
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let id: string | null = null;
|
||||
export let name: string | null = null;
|
||||
export let value: string | null = null;
|
||||
export let value: any | null = null;
|
||||
export let label: string | null = null;
|
||||
export let notice: string | null = null;
|
||||
export let required = false;
|
||||
|
@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
export let id: string | null = null;
|
||||
export let name: string | null = null;
|
||||
export let value: string | null = null;
|
||||
@ -6,8 +8,11 @@
|
||||
export let notice: string | null = null;
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let readonly = false;
|
||||
export let size: 'xs' | 'sm' | 'md' | 'lg' = 'md';
|
||||
export let rows = 2;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
<div>
|
||||
@ -22,17 +27,20 @@
|
||||
</label>
|
||||
{/if}
|
||||
<textarea
|
||||
class="textarea textarea-bordered w-full"
|
||||
class="textarea w-full"
|
||||
class:textarea-xs={size === 'xs'}
|
||||
class:textarea-sm={size === 'sm'}
|
||||
class:textarea-md={size === 'md'}
|
||||
class:textarea-lg={size === 'lg'}
|
||||
class:textarea-bordered={!readonly}
|
||||
{id}
|
||||
{name}
|
||||
{required}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{rows}
|
||||
bind:value
|
||||
on:click={(e) => dispatch('click', e)}
|
||||
/>
|
||||
{#if notice}
|
||||
<label class="label" for={id}>
|
||||
|
@ -3,6 +3,8 @@ export class Permissions {
|
||||
static readonly AdminWrite = 4;
|
||||
static readonly UserRead = 8;
|
||||
static readonly UserWrite = 16;
|
||||
static readonly ReportRead = 32;
|
||||
static readonly ReportWrite = 64;
|
||||
|
||||
readonly value: number;
|
||||
|
||||
@ -29,7 +31,9 @@ export class Permissions {
|
||||
Permissions.AdminRead,
|
||||
Permissions.AdminWrite,
|
||||
Permissions.UserRead,
|
||||
Permissions.UserWrite
|
||||
Permissions.UserWrite,
|
||||
Permissions.ReportRead,
|
||||
Permissions.ReportWrite
|
||||
];
|
||||
}
|
||||
|
||||
@ -45,6 +49,12 @@ export class Permissions {
|
||||
userWrite(): boolean {
|
||||
return (this.value & Permissions.UserWrite) != 0;
|
||||
}
|
||||
reportRead(): boolean {
|
||||
return (this.value & Permissions.ReportRead) != 0;
|
||||
}
|
||||
reportWrite(): boolean {
|
||||
return (this.value & Permissions.ReportWrite) != 0;
|
||||
}
|
||||
|
||||
asArray(): number[] {
|
||||
const array = [];
|
||||
|
@ -40,26 +40,35 @@ export class User extends Model {
|
||||
export class Report extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false, unique: true })
|
||||
@Index
|
||||
declare url_id: string;
|
||||
declare url_hash: string;
|
||||
@Column({ type: DataTypes.STRING, allowNull: false })
|
||||
declare subject: string;
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare body: string;
|
||||
@Column({ type: DataTypes.BOOLEAN, allowNull: false })
|
||||
declare draft: boolean;
|
||||
@Column({ type: DataTypes.BOOLEAN, allowNull: false })
|
||||
declare completed: boolean;
|
||||
@Column({ type: DataTypes.ENUM('java', 'bedrock', 'cracked'), allowNull: false })
|
||||
declare status: 'none' | 'review' | 'reviewed';
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare notice: string;
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare statement: string;
|
||||
@Column({ type: DataTypes.INTEGER, allowNull: false })
|
||||
@ForeignKey(() => User)
|
||||
declare reporter_user_id: number;
|
||||
declare reporter_id: number;
|
||||
@Column({ type: DataTypes.INTEGER, allowNull: false })
|
||||
@ForeignKey(() => User)
|
||||
declare reported_user_id: number;
|
||||
declare reported_id: number;
|
||||
@Column({ type: DataTypes.INTEGER })
|
||||
@ForeignKey(() => Admin)
|
||||
declare auditor_id: number;
|
||||
|
||||
@BelongsTo(() => User)
|
||||
@BelongsTo(() => User, 'reporter_id')
|
||||
declare reporter: User;
|
||||
@BelongsTo(() => User)
|
||||
@BelongsTo(() => User, 'reported_id')
|
||||
declare reported: User;
|
||||
@BelongsTo(() => Admin, 'auditor_id')
|
||||
declare auditor: Admin;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'admin', underscored: true })
|
||||
|
@ -4,4 +4,5 @@ import { writable } from 'svelte/store';
|
||||
|
||||
export const playAudio: Writable<boolean> = persisted('playAudio', false);
|
||||
|
||||
export const reportCount: Writable<number> = writable(0);
|
||||
export const adminCount: Writable<number> = writable(0);
|
||||
|
Reference in New Issue
Block a user