Semillas

Las semillas representan el inventario de material genetico disponible para cultivo. Esta API permite gestionar lotes de semillas, su trazabilidad y el proceso de germinacion.


El modelo de Semilla

  • Name
    id
    Type
    string
    Description

    Identificador unico.

  • Name
    name
    Type
    string
    Description

    Nombre del lote.

  • Name
    strain
    Type
    object
    Description

    Cepa genetica.

    • Name
      id
      Type
      string
      Description

      ID de la cepa.

    • Name
      name
      Type
      string
      Description

      Nombre de la cepa.

    • Name
      type
      Type
      string
      Description

      Tipo: indica, sativa, hybrid.

  • Name
    status
    Type
    SeedStatus
    Description

    Estado actual.

  • Name
    quantity
    Type
    number
    Description

    Cantidad disponible.

  • Name
    batchNumber
    Type
    string
    Description

    Numero de lote.

  • Name
    breeder
    Type
    string
    Description

    Banco de semillas/criador.

  • Name
    supplier
    Type
    string
    Description

    Proveedor.

  • Name
    feminized
    Type
    boolean
    Description

    Si son feminizadas.

  • Name
    autoflower
    Type
    boolean
    Description

    Si son autoflorecientes.

  • Name
    germinationRate
    Type
    number
    Description

    Tasa de germinacion (%).

  • Name
    pricePerSeed
    Type
    number
    Description

    Precio por unidad.

  • Name
    origin
    Type
    SeedOrigin
    Description

    Origen de las semillas.

  • Name
    storageLocation
    Type
    string
    Description

    Ubicacion de almacenamiento.

  • Name
    purchasedAt
    Type
    timestamp
    Description

    Fecha de compra.

  • Name
    expiresAt
    Type
    timestamp
    Description

    Fecha de vencimiento.

Ejemplo de semilla

{
  "id": "seed-001",
  "name": "Blue Dream Feminized Pack",
  "strain": {
    "id": "strain_blue_dream",
    "name": "Blue Dream",
    "type": "hybrid"
  },
  "status": "AVAILABLE",
  "quantity": 10,
  "batchNumber": "BD-FEM-2024-001",
  "breeder": "Humboldt Seed Organization",
  "supplier": "SeedBank Pro",
  "feminized": true,
  "autoflower": false,
  "germinationRate": 95,
  "pricePerSeed": 12.5,
  "origin": "PURCHASED",
  "storageLocation": "Refrigerador A - Gaveta 2",
  "purchasedAt": "2024-03-15T00:00:00Z",
  "expiresAt": "2027-03-15T00:00:00Z",
  "createdAt": "2024-03-15T10:00:00Z",
  "updatedAt": "2024-10-01T14:30:00Z"
}

Estados de Semilla (SeedStatus)

Loading diagram...
EstadoDescripcion
AVAILABLEDisponible para uso
RESERVEDReservada para cultivo
GERMINATINGEn proceso de germinacion
PLANTEDPlantada en cultivo
EXPIREDVencida/inutilizable
FAILEDGerminacion fallida

Origen de Semillas (SeedOrigin)

OrigenDescripcion
PURCHASEDComprada a banco/proveedor
BREDProducida internamente
GIFTEDRecibida como regalo
COLLECTEDRecolectada de plantas

GET/api/stock/seeds

Listar semillas

Parametros de Consulta

  • Name
    strainId
    Type
    string
    Description

    Filtrar por cepa.

  • Name
    status
    Type
    SeedStatus
    Description

    Filtrar por estado.

  • Name
    breeder
    Type
    string
    Description

    Filtrar por criador/banco.

  • Name
    feminized
    Type
    boolean
    Description

    Solo feminizadas.

  • Name
    autoflower
    Type
    boolean
    Description

    Solo autoflorecientes.

  • Name
    search
    Type
    string
    Description

    Busqueda por nombre o lote.

  • Name
    page
    Type
    number
    Description

    Pagina (default: 1).

  • Name
    limit
    Type
    number
    Description

    Items por pagina (default: 20).

Request

GET
/api/stock/seeds
curl -G https://api.cannahub.tech/api/stock/seeds \
  -H "Authorization: Bearer {token}" \
  -d status=AVAILABLE \
  -d feminized=true

Response

{
  "seeds": [...],
  "count": 8,
  "filters": { "status": "AVAILABLE", "feminized": "true" }
}

POST/api/stock/seeds

Crear lote de semillas

Registra un nuevo lote de semillas.

Campos Requeridos

  • Name
    name
    Type
    string
    Description

    Nombre del lote.

  • Name
    strainId
    Type
    string
    Description

    ID de la cepa.

  • Name
    quantity
    Type
    number
    Description

    Cantidad de semillas.

  • Name
    batchNumber
    Type
    string
    Description

    Numero de lote.

  • Name
    feminized
    Type
    boolean
    Description

    Si son feminizadas.

  • Name
    autoflower
    Type
    boolean
    Description

    Si son autoflorecientes.

Campos Opcionales

  • Name
    breeder
    Type
    string
    Description

    Banco/criador.

  • Name
    supplier
    Type
    string
    Description

    Proveedor.

  • Name
    pricePerSeed
    Type
    number
    Description

    Precio por unidad.

  • Name
    storageLocation
    Type
    string
    Description

    Ubicacion de almacenamiento.

  • Name
    notes
    Type
    string
    Description

    Notas adicionales.

Request

POST
/api/stock/seeds
curl -X POST https://api.cannahub.tech/api/stock/seeds \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "OG Kush Auto Pack",
    "strainId": "strain_og_kush",
    "quantity": 5,
    "batchNumber": "OGK-AUTO-2024-001",
    "feminized": true,
    "autoflower": true,
    "breeder": "Dutch Passion",
    "pricePerSeed": 15.0
  }'

Response (201)

{
  "seed": {
    "id": "seed-1698765432100",
    "name": "OG Kush Auto Pack",
    "status": "AVAILABLE",
    "quantity": 5,
    "batchNumber": "OGK-AUTO-2024-001",
    "feminized": true,
    "autoflower": true
  }
}

GET/api/stock/seeds/:id

Obtener semilla

Retorna los detalles de un lote de semillas.

Request

curl https://api.cannahub.tech/api/stock/seeds/seed-001 \
  -H "Authorization: Bearer {token}"

PATCH/api/stock/seeds/:id

Actualizar semilla

Actualiza datos del lote de semillas.

Campos Actualizables

  • Name
    status
    Type
    SeedStatus
    Description

    Nuevo estado.

  • Name
    quantity
    Type
    number
    Description

    Cantidad actualizada.

  • Name
    germinationRate
    Type
    number
    Description

    Tasa de germinacion observada.

  • Name
    storageLocation
    Type
    string
    Description

    Nueva ubicacion.

  • Name
    notes
    Type
    string
    Description

    Notas adicionales.

Request

PATCH
/api/stock/seeds/:id
curl -X PATCH https://api.cannahub.tech/api/stock/seeds/seed-001 \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 8,
    "notes": "Usadas 2 para germinacion"
  }'

DELETE/api/stock/seeds/:id

Eliminar semilla

Elimina un lote de semillas del inventario.

Request

curl -X DELETE https://api.cannahub.tech/api/stock/seeds/seed-001 \
  -H "Authorization: Bearer {token}"

POST/api/stock/seeds/:id/germinate

Germinar semillas

Inicia el proceso de germinacion para semillas del lote.

Campos Requeridos

  • Name
    quantity
    Type
    number
    Description

    Cantidad de semillas a germinar.

Campos Opcionales

  • Name
    spaceName
    Type
    string
    Description

    Nombre del espacio de germinacion.

  • Name
    notes
    Type
    string
    Description

    Notas del proceso.

Respuesta

La operacion actualiza el estado de las semillas y puede crear un nuevo cultivo automaticamente.

Request

POST
/api/stock/seeds/:id/germinate
curl -X POST https://api.cannahub.tech/api/stock/seeds/seed-001/germinate \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 3,
    "spaceName": "Germinador A",
    "notes": "Metodo papel humedo"
  }'

Response

{
  "success": true,
  "seed": {
    "id": "seed-001",
    "status": "GERMINATING",
    "quantity": 7
  },
  "cropId": "crop-1698765432100",
  "message": "Germinacion iniciada para 3 semillas"
}

Almacenamiento de Semillas

Recomendaciones para preservar viabilidad:

FactorRecomendacionImpacto
Temperatura4-8°C (refrigerador)+3-5 anos viabilidad
HumedadMenor a 10% (con silica)Previene hongos
LuzOscuridad totalEvita activacion prematura
ContenedorHermetico, opacoProteccion ambiental

React Query Hooks

Uso de hooks

import {
  useSeedsQuery,
  useSeedQuery,
  useCreateSeedMutation,
  useUpdateSeedMutation,
  useDeleteSeedMutation,
  useGerminateSeedMutation
} from '@/features/Club/Seeds/hooks'

// Listar semillas con filtros
const { data: seeds, isLoading } = useSeedsQuery({
  status: 'AVAILABLE',
  feminized: true
})

// Obtener una semilla
const { data: seed } = useSeedQuery('seed-001')

// Crear semilla
const createMutation = useCreateSeedMutation()
await createMutation.mutateAsync({
  name: 'Blue Dream Feminized',
  strainId: 'strain-001',
  quantity: 10,
  batchNumber: 'BD-2024-001',
  feminized: true,
  autoflower: false
})

// Actualizar semilla
const updateMutation = useUpdateSeedMutation()
await updateMutation.mutateAsync({
  id: 'seed-001',
  data: { quantity: 8, storageLocation: 'Refrigerador A' }
})

// Germinar semillas
const germinateMutation = useGerminateSeedMutation()
await germinateMutation.mutateAsync({
  id: 'seed-001',
  data: { quantity: 3, spaceName: 'Germinador A' }
})

// Eliminar semilla
const deleteMutation = useDeleteSeedMutation()
await deleteMutation.mutateAsync('seed-001')

Query Keys

seedKeys = {
  all: ['seeds'],
  lists: () => ['seeds', 'list'],
  list: (filters) => ['seeds', 'list', filters],
  details: () => ['seeds', 'detail'],
  detail: (id) => ['seeds', 'detail', id]
}

Proximos Pasos

Was this page helpful?