Skip to content

Commit

Permalink
Song URL: DB schema and data for ES, adapt Insert Song form
Browse files Browse the repository at this point in the history
  • Loading branch information
isra00 committed Apr 28, 2024
1 parent bfd5166 commit ae99ab7
Show file tree
Hide file tree
Showing 7 changed files with 1,166 additions and 1,153 deletions.
1 change: 1 addition & 0 deletions create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ CREATE TABLE `song` (
`people_lowest_note` char(3) DEFAULT NULL,
`people_highest_note` char(3) DEFAULT NULL,
`artistic_adjustment` tinyint DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id_song`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=MyISAM AUTO_INCREMENT=1205 DEFAULT CHARSET=utf8mb3;
Expand Down
2,294 changes: 1,148 additions & 1,146 deletions song_data.sql

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/NeoTransposer/Domain/Repository/SongRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function createSong(
string $peopleHighestNote,
bool $firstChordIsNote,
string $slug,
array $chords
array $chords,
?string $url = null
): void;

public function slugAlreadyExists(string $slug): bool;
Expand Down
6 changes: 4 additions & 2 deletions src/NeoTransposer/Domain/Service/SongCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function createSong(
string $peopleLowestNote,
string $peopleHighestNote,
bool $firstChordIsNote,
array $chords
array $chords,
?string $url = null
): void {

$this->songRepository->createSong(
Expand All @@ -36,7 +37,8 @@ public function createSong(
$peopleHighestNote,
$firstChordIsNote,
$this->getSlug($title, $idBook),
$chords
$chords,
$url
);
}

Expand Down
6 changes: 4 additions & 2 deletions src/NeoTransposer/Infrastructure/SongRepositoryMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ public function createSong(
string $peopleHighestNote,
bool $firstChordIsNote,
string $slug,
array $chords
array $chords,
?string $url = null
): void {

$this->dbConnection->insert('song', [
Expand All @@ -120,7 +121,8 @@ public function createSong(
'people_lowest_note' => $peopleLowestNote,
'people_highest_note' => $peopleHighestNote,
'first_chord_is_tone' => $firstChordIsNote,
'slug' => $slug
'slug' => $slug,
'url' => $url
]);

$idSong = $this->dbConnection->lastInsertId();
Expand Down
7 changes: 6 additions & 1 deletion templates/insert_song.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
</select>
</p>

<p class="field-title">
<p class="field-wide">
<label for="title">Title:</label>
<input type="text" name="title" id="title" size="50" autofocus required>
</p>

<p class="field-wide">
<label for="url">URL:</label>
<input name="url" id="url" type="text" size="50" pattern="^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$">
</p>

<p>
<label for="page">Page:</label>
Expand Down
2 changes: 1 addition & 1 deletion web/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ h2.step-1 {
width: 2.5em;
font-size: 1em;
}
.insert-song .field-title input[type=text] {
.insert-song .field-wide input[type=text] {
width: auto;
}

Expand Down

0 comments on commit ae99ab7

Please sign in to comment.