refactor(Filter): umbenennen in Attribut

This commit is contained in:
tekh 2025-07-14 11:42:29 +02:00
parent 75ecbba71d
commit 8bfcd65ad1
3 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import { Doc } from 'src/api/document-service';
import { Product } from 'src/api/product-service';
import { Filter } from 'src/api/attribute-service';
import { Attribute } from 'src/api/attribute-service';
import {
_id,
@ -232,7 +232,7 @@ export const _products: Product[] = [
// ----------------------------------------------------------------------
export const _filters: Filter[] = [
export const _attributes: Attribute[] = [
{ id: 1, label: 'Rechnungsnummer', name: 'invoiceNumber', type: 'VARCHAR' },
{ id: 2, label: 'Kundenname', name: 'customerName', type: 'INTEGER' },
{ id: 3, label: 'Startdatum', name: 'startDate', type: 'DATE' },

View File

@ -1,4 +1,4 @@
import { _filters } from 'src/_mock/_data';
import { _attributes } from 'src/_mock/_data';
export type Type = 'BOOLEAN' | 'DATE' | 'TIME' | 'DATETIME' | 'VARCHAR' | 'INTEGER' | 'DECIMAL';
@ -18,19 +18,19 @@ export type AttributeCreateDto = {
type: Type;
};
export type Filter = AttributeCreateDto & {
export type Attribute = AttributeCreateDto & {
id: number;
};
export function getAttributes(): Promise<Filter[]> {
return Promise.resolve(_filters);
export function getAttributes(): Promise<Attribute[]> {
return Promise.resolve(_attributes);
}
export function createAttributes(filter: AttributeCreateDto): Promise<Filter> {
const newFilter: Filter = {
export function createAttributes(filter: AttributeCreateDto): Promise<Attribute> {
const newFilter: Attribute = {
...filter,
id: _filters.length + 1
id: _attributes.length + 1
};
_filters.push(newFilter);
_attributes.push(newFilter);
return Promise.resolve(newFilter);
}

View File

@ -8,7 +8,7 @@ import Pagination from '@mui/material/Pagination';
import { Doc } from 'src/api/document-service';
import { DashboardContent } from 'src/layouts/dashboard';
import { Filter, getAttributes } from 'src/api/attribute-service';
import { Attribute, getAttributes } from 'src/api/attribute-service';
import { Iconify } from 'src/components/iconify';
@ -27,7 +27,7 @@ type Props = {
export function DocSearchView({ docs }: Props) {
const [sortBy, setSortBy] = useState('latest');
const [filters, setFilters] = useState<Filter[]>([])
const [filters, setFilters] = useState<Attribute[]>([])
const handleSort = useCallback((newSort: string) => {
setSortBy(newSort);