Skip to main content

Overview

GIMA uses TypeScript types to ensure type safety for user-related data throughout the application. The user types define the structure of user objects and their possible states.

User Interface

The main User interface represents a user entity in the GIMA system.
export interface User {
    id: string;
    iniciales: string;
    name: string;
    email: string;
    rol: string;
    department: string;
    status: UserEstado;
}

Properties

id
string
required
Unique identifier for the user.Example: "1", "2"
iniciales
string
required
User’s initials, typically used for avatar displays.Example: "FC" for Frank Chacon, "NE" for Nour Ehab
name
string
required
Full name of the user.Example: "Frank Chacon", "Nour Ehab"
email
string
required
User’s email address.Example: "[email protected]"
rol
string
required
User’s role or job title within the organization.Example: "Engineer", "Doctor", "Graduated"
department
string
required
Department or area where the user works.Example: "frontend", "cardiology", "pediatrics"
status
UserEstado
required
Current availability status of the user. See UserEstado for possible values.

UserEstado Type

The UserEstado type defines the possible availability states for a user.
export type UserEstado = 'available' | 'unavailable';

Values

available
literal
User is currently available for tasks or assignments.
unavailable
literal
User is currently unavailable (e.g., on leave, busy, or offline).

Usage Examples

Creating a User Object

import { User, UserEstado } from '@/types/user';

const newUser: User = {
  id: '5',
  iniciales: 'JD',
  name: 'John Doe',
  email: '[email protected]',
  rol: 'Engineer',
  department: 'backend',
  status: 'available'
};

Working with User Arrays

The mock data in src/utils/mockUsers.ts demonstrates how to work with arrays of users:
import { User, UserEstado } from '../types/user';

export const mockUsers: User[] = [
  {
    id: '1',
    iniciales: 'FC',
    name: 'Frank Chacon',
    email: '[email protected]',
    rol: 'Engineer',
    department: 'frontend',
    status: 'unavailable',
  },
  {
    id: '2',
    iniciales: 'NE',
    name: 'Nour Ehab',
    email: '[email protected]',
    rol: 'Doctor',
    department: 'cardiology',
    status: 'available',
  },
];

Type Guards

You can create type guards to check user status:
function isUserAvailable(user: User): boolean {
  return user.status === 'available';
}

const availableUsers = mockUsers.filter(isUserAvailable);

Source Files

  • Type definitions: src/types/user.ts
  • Mock data: src/utils/mockUsers.ts

Build docs developers (and LLMs) love