Lands-Horizon-Corp / horizon-corp

https://horizon-corp.vercel.app
3 stars 0 forks source link

Docker Requirements Documentation

Setup

Migration

  1. Seeding & Migration (Initializing Database):

    docker compose run --rm flyway migrate

    Executes migrations to update the database schema.

  2. Baseline:

    docker compose run --rm flyway baseline -v 1 -d "Initial baseline"

    Creates a baseline version of the database schema.

  3. Clean:

    docker compose run --rm flyway clean

    Drops all objects from the database.

  4. Info:

    docker compose run --rm flyway info

    Shows the status of all migrations.

  5. Validate:

    docker compose run --rm flyway validate

    Validates the applied migrations against the available ones.

  6. Undo (Teams Edition):

    docker compose run --rm flyway undo

    Undoes the last applied migration. (Available in Flyway Teams Edition)

  7. Repair:

    docker compose run --rm flyway repair

    Repairs the metadata table.

  8. Generate:

    docker compose run --rm flyway generate

    Generates new migration scripts.


AWS Deployment


Local Setup

Docker

setup github pipeline workflow

> create mysql instance 
> create s3 storage instance
> migrate flyway to mysql aws 
> deploy backend
> deploy backend

setup toastify

setup error handling

setup authentication

// interfaces.ts
export interface Filter {
  field: string;
  operator: string;
  value: any;
}

export interface Pagination {
  limit: number;
  page: number;
  sortBy?: string;
  sortOrder?: string;
  total?: number;
  totalPages?: number;
  prevPage?: number;
  nextPage?: number;
}

export interface ListRequest {
  filters: Filter[];
  pagination: Pagination;
}

export interface ListResponse<T> {
  data: T[];
  pagination: Pagination;
}
// api.ts
import axios from 'axios';
import { ListRequest, ListResponse } from './interfaces';

export async function listEntities<T>(endpoint: string, request: ListRequest): Promise<ListResponse<T>> {
  const response = await axios.post<ListResponse<T>>(endpoint, request);
  return response.data;
}
// UserList.vue (similar to the previous example)
import { listEntities } from './api';
import { User, Pagination, Filter } from './interfaces';

const fetchUsers = async () => {
  // Build filters and request
  const request = {
    filters: filters.value,
    pagination: pagination.value,
  };

  const response = await listEntities<User>('/users', request);
  users.value = response.data;
  pagination.value = response.pagination;
};