Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions .github/workflows/cli_test.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: Test CLI Generated Project
# name: Test CLI Generated Project

on: [push]
# on: [push]

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17.4-bookworm
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432
options: >-
--health-cmd "pg_isready"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install the project
run: uv sync --all-extras --dev
- name: Generate example project
run: uv run -m fastapi_forge start --use-example --no-ui --yes
- name: Run tests
working-directory: ./game_zone
env:
GAME_ZONE_PG_HOST: localhost
GAME_ZONE_PG_PORT: ${{ job.services.postgres.ports['5432'] }}
GAME_ZONE_PG_USER: postgres
GAME_ZONE_PG_PASSWORD: postgres
GAME_ZONE_PG_DATABASE: postgres
run: uv run pytest ./tests -v -s
# jobs:
# test:
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres:17.4-bookworm
# env:
# POSTGRES_PASSWORD: postgres
# POSTGRES_USER: postgres
# POSTGRES_DB: postgres
# ports:
# - 5432
# options: >-
# --health-cmd "pg_isready"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# steps:
# - uses: actions/checkout@v4
# - name: Install uv
# uses: astral-sh/setup-uv@v5
# - name: "Set up Python"
# uses: actions/setup-python@v5
# with:
# python-version-file: "pyproject.toml"
# - name: Install the project
# run: uv sync --all-extras --dev
# - name: Generate example project
# run: uv run -m fastapi_forge start --use-example --no-ui --yes
# - name: Run tests
# working-directory: ./game_zone
# env:
# GAME_ZONE_PG_HOST: localhost
# GAME_ZONE_PG_PORT: ${{ job.services.postgres.ports['5432'] }}
# GAME_ZONE_PG_USER: postgres
# GAME_ZONE_PG_PASSWORD: postgres
# GAME_ZONE_PG_DATABASE: postgres
# run: uv run pytest ./tests -v -s
2 changes: 1 addition & 1 deletion frontend/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body {
:root {
--color-primary: #5294fd;
--color-secondary: #dcebfe;
--color-success: #b8fd9f;
--color-success: #7fbc8c;
--color-danger: #ff6b6b;
--color-background: #f4f4f0;
}
2 changes: 1 addition & 1 deletion frontend/src/components/StepWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const goToStep = (index) => {
}

.step.completed {
background-color: #7fbc8c;
background-color: var(--color-success);
}

.step-content {
Expand Down
101 changes: 101 additions & 0 deletions frontend/src/components/modal/AddEnumValueModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<template>
<main class="field-modal-container">
<div class="input-container">
<div class="input-group">
<label class="field-label">Name</label>
<input class="field-input" v-model="name" type="text" />
</div>

<div class="input-group">
<label class="field-label">Value</label>
<input class="field-input" v-model="value" type="text" />
</div>
</div>

<div class="action-group">
<button class="save-field-btn" @click="saveEnumValue">Save</button>
</div>
</main>
</template>

<script setup lang="ts">
import { ref } from "vue"
import { useProjectStore } from "@/stores/useProjectStore"
import { useModalStore } from "@/stores/useModalStore"

const props = defineProps<{
enumName: string
}>()

const projectStore = useProjectStore()
const modalStore = useModalStore()

const name = ref("")
const value = ref("auto()")

const saveEnumValue = () => {
projectStore.addEnumValue(props.enumName, {
name: name.value,
value: value.value,
})
modalStore.close()
}
</script>

<style scoped>
.field-modal-container {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}

.input-container {
display: flex;
flex-direction: column;
gap: 1rem;
}

.input-group {
display: flex;
flex-direction: column;
gap: 0.15rem;
}

.field-label {
font-weight: bold;
margin-bottom: 5px;
}

.field-input {
border: 2px solid black;
border-radius: 6px;
padding: 0.6rem;
background-color: white;
}

.action-group {
gap: 0.5rem;
margin-top: 2rem;
display: flex;
flex-direction: column;
}

.save-field-btn {
width: 100%;
padding: 0.5rem 1rem;
border: 2px solid black;
border-radius: 4px;
background-color: var(--color-success);
box-shadow: 3px 3px 0px black;
transition:
transform 0.1s ease-in-out,
box-shadow 0.1s ease-in-out;
}

.save-field-btn:hover {
cursor: pointer;
transform: translate(2px, 2px);
box-shadow: none;
}
</style>
27 changes: 24 additions & 3 deletions frontend/src/components/modal/AddFieldModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,29 @@
<option value="DateTime">DateTime</option>
<option value="Boolean">Boolean</option>
<option value="Float">Float</option>
<option value="Enum">Enum</option>
</select>
</div>

<div class="input-group" v-if="type === 'Enum'">
<label class="field-label">Select Enum</label>
<select class="field-select" v-model="selectedEnum">
<option disabled value="">-- Select Enum --</option>
<option v-for="e in projectStore.enums" :key="e.name" :value="e">
{{ e.name }}
</option>
</select>
</div>

<div class="input-group">
<label class="field-label">Default value</label>
<input class="field-input" v-model="defaultValue" type="text" />
<select class="field-select" v-model="defaultValue" v-if="type === 'Enum'">
<option value="" />
<option v-for="v in selectedEnum?.values" :key="v.name" :value="v.name">
{{ v.name }}
</option>
</select>
<input class="field-input" v-model="defaultValue" type="text" v-else />
</div>
</div>

Expand All @@ -42,6 +59,7 @@
import { ref } from "vue"
import { useProjectStore } from "@/stores/useProjectStore"
import { useModalStore } from "@/stores/useModalStore"
import type { EnumT, FieldType } from "@/types/types"

const props = defineProps<{
id: string
Expand All @@ -50,6 +68,8 @@ const props = defineProps<{
const projectStore = useProjectStore()
const modalStore = useModalStore()

const selectedEnum = ref<EnumT | undefined>()

const fieldName = ref("")
const type = ref("")
const defaultValue = ref("")
Expand All @@ -62,12 +82,13 @@ const saveField = () => {
if (!fieldName.value || !type.value) return
projectStore.addField(props.id, {
name: fieldName.value,
type: type.value,
default: defaultValue.value || undefined,
type: type.value as FieldType,
typeEnum: selectedEnum.value?.name,
isPrimaryKey: isPrimaryKey.value,
isNullable: isNullable.value,
isUnique: isUnique.value,
isIndex: isIndex.value,
defaultValue: defaultValue.value || undefined,
})
modalStore.close()
}
Expand Down
103 changes: 103 additions & 0 deletions frontend/src/components/modal/EditEnumValueModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<template>
<main class="field-modal-container">
<div class="input-container">
<div class="input-group">
<label class="field-label">Name</label>
<input class="field-input" v-model="name" type="text" />
</div>

<div class="input-group">
<label class="field-label">Value</label>
<input class="field-input" v-model="value" type="text" />
</div>
</div>

<div class="action-group">
<button class="save-field-btn" @click="saveEnumValue">Save</button>
</div>
</main>
</template>

<script setup lang="ts">
import { ref } from "vue"
import { useProjectStore } from "@/stores/useProjectStore"
import { useModalStore } from "@/stores/useModalStore"
import type { EnumValue } from "@/types/types"

const props = defineProps<{
enumName: string
enumValue: EnumValue
}>()

const projectStore = useProjectStore()
const modalStore = useModalStore()

const name = ref(props.enumValue.name)
const value = ref(props.enumValue.value)

const saveEnumValue = () => {
projectStore.updateEnumValue(props.enumName, props.enumValue.name, {
name: name.value,
value: value.value,
})
modalStore.close()
}
</script>

<style scoped>
.field-modal-container {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
}

.input-container {
display: flex;
flex-direction: column;
gap: 1rem;
}

.input-group {
display: flex;
flex-direction: column;
gap: 0.15rem;
}

.field-label {
font-weight: bold;
margin-bottom: 5px;
}

.field-input {
border: 2px solid black;
border-radius: 6px;
padding: 0.6rem;
background-color: white;
}

.action-group {
gap: 0.5rem;
margin-top: 2rem;
display: flex;
flex-direction: column;
}

.save-field-btn {
width: 100%;
padding: 0.5rem 1rem;
border: 2px solid black;
border-radius: 4px;
background-color: var(--color-success);
box-shadow: 3px 3px 0px black;
transition:
transform 0.1s ease-in-out,
box-shadow 0.1s ease-in-out;
}

.save-field-btn:hover {
cursor: pointer;
transform: translate(2px, 2px);
box-shadow: none;
}
</style>
Loading