add report page
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let size: 'xs' | 'sm' | 'md' | 'lg' = 'md';
|
||||
export let pickyWidth = true;
|
||||
|
||||
export let inputElement: HTMLInputElement | undefined = undefined;
|
||||
|
||||
@ -60,7 +61,10 @@
|
||||
</span>
|
||||
</label>
|
||||
{/if}
|
||||
<div class="relative flex items-center" class:sm:max-w-[16rem]={type !== 'checkbox'}>
|
||||
<div
|
||||
class="relative flex items-center"
|
||||
class:sm:max-w-[16rem]={type !== 'checkbox' && pickyWidth}
|
||||
>
|
||||
<input
|
||||
class:checkbox={type === 'checkbox'}
|
||||
class:checkbox-xs={type === 'checkbox' && size === 'xs'}
|
||||
|
42
src/lib/components/Input/Textarea.svelte
Normal file
42
src/lib/components/Input/Textarea.svelte
Normal file
@ -0,0 +1,42 @@
|
||||
<script lang="ts">
|
||||
export let id: string | null = null;
|
||||
export let name: string | null = null;
|
||||
export let value: string | null = null;
|
||||
export let label: string | null = null;
|
||||
export let notice: string | null = null;
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let size: 'xs' | 'sm' | 'md' | 'lg' = 'md';
|
||||
export let rows = 2;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
{#if label}
|
||||
<label class="label" for={id}>
|
||||
<span class="label-text">
|
||||
{label}
|
||||
{#if required}
|
||||
<span class="text-red-700">*</span>
|
||||
{/if}
|
||||
</span>
|
||||
</label>
|
||||
{/if}
|
||||
<textarea
|
||||
class="textarea textarea-bordered w-full"
|
||||
class:textarea-xs={size === 'xs'}
|
||||
class:textarea-sm={size === 'sm'}
|
||||
class:textarea-md={size === 'md'}
|
||||
class:textarea-lg={size === 'lg'}
|
||||
{id}
|
||||
{name}
|
||||
{required}
|
||||
{disabled}
|
||||
{rows}
|
||||
bind:value
|
||||
/>
|
||||
{#if notice}
|
||||
<label class="label" for={id}>
|
||||
<span class="label-text-alt">{notice}</span>
|
||||
</label>
|
||||
{/if}
|
||||
</div>
|
@ -5,15 +5,17 @@ import * as bcrypt from 'bcrypt';
|
||||
import {
|
||||
BeforeCreate,
|
||||
BeforeUpdate,
|
||||
BelongsTo,
|
||||
Column,
|
||||
ForeignKey,
|
||||
Index,
|
||||
Model,
|
||||
Sequelize,
|
||||
Table,
|
||||
Unique
|
||||
Table
|
||||
} from 'sequelize-typescript';
|
||||
import { Permissions } from '$lib/permissions';
|
||||
|
||||
@Table({ modelName: 'user' })
|
||||
@Table({ modelName: 'user', underscored: true })
|
||||
export class User extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false })
|
||||
declare firstname: string;
|
||||
@ -30,10 +32,37 @@ export class User extends Model {
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare password: string;
|
||||
@Column({ type: DataTypes.UUIDV4 })
|
||||
@Index
|
||||
declare uuid: string;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'admin' })
|
||||
@Table({ modelName: 'report', underscored: true })
|
||||
export class Report extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false, unique: true })
|
||||
@Index
|
||||
declare url_id: 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.INTEGER, allowNull: false })
|
||||
@ForeignKey(() => User)
|
||||
declare reporter_user_id: number;
|
||||
@Column({ type: DataTypes.INTEGER, allowNull: false })
|
||||
@ForeignKey(() => User)
|
||||
declare reported_user_id: number;
|
||||
|
||||
@BelongsTo(() => User)
|
||||
declare reporter: User;
|
||||
@BelongsTo(() => User)
|
||||
declare reported: User;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'admin', underscored: true })
|
||||
export class Admin extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false, unique: true })
|
||||
declare username: string;
|
||||
@ -68,5 +97,5 @@ export class Admin extends Model {
|
||||
export const sequelize = new Sequelize(building ? 'sqlite::memory:' : env.DATABASE_URI, {
|
||||
// only log sql queries in dev mode
|
||||
logging: dev ? console.log : false,
|
||||
models: [User, Admin]
|
||||
models: [User, Report, Admin]
|
||||
});
|
||||
|
Reference in New Issue
Block a user