-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added table for SpectatorMembers in an Ensemble
Updated EnsembleDbo to include spectators when mapping to/from Domain and Database objects
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/jitterted/mobreg/adapter/out/jdbc/SpectatorMember.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.jitterted.mobreg.adapter.out.jdbc; | ||
|
||
import com.jitterted.mobreg.domain.MemberId; | ||
import org.springframework.data.annotation.Id; | ||
|
||
//equivalent to @Table("spectator_member") -- WARNING: Case-sensitive | ||
public class SpectatorMember { | ||
@Id | ||
public Long memberId; | ||
|
||
// this constructor is necessary for Spring Data JDBC to use the name of the public Long memberId | ||
// otherwise it'd use the name of the parameter to the single-parameter constructor (???) | ||
public SpectatorMember() { | ||
} | ||
|
||
public SpectatorMember(long id) { | ||
this.memberId = id; | ||
} | ||
|
||
static SpectatorMember toEntityId(MemberId memberId) { | ||
return new SpectatorMember(memberId.id()); | ||
} | ||
|
||
MemberId asMemberId() { | ||
return MemberId.of(memberId); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/db/migration/V13__add_spectator_member_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE declined_member | ||
( | ||
member_id BIGINT NOT NULL, | ||
ensemble_id BIGINT NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters