mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 15:51:14 +00:00
typo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package model
|
||||
|
||||
type Charactor struct {
|
||||
type Character struct {
|
||||
ID uint `gorm:"primaryKey;autoIncrement"`
|
||||
Name string `gorm:"type:varchar(100);not null"`
|
||||
Alias []string `gorm:"serializer:json"`
|
||||
@@ -11,7 +11,7 @@ type Charactor struct {
|
||||
Image *Image `gorm:"foreignKey:ImageID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
|
||||
}
|
||||
|
||||
type CharactorView struct {
|
||||
type CharacterView struct {
|
||||
Id uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Alias []string `json:"alias"`
|
||||
@@ -20,8 +20,8 @@ type CharactorView struct {
|
||||
Image uint `json:"image"`
|
||||
}
|
||||
|
||||
func (c *Charactor) ToView() *CharactorView {
|
||||
return &CharactorView{
|
||||
func (c *Character) ToView() *CharacterView {
|
||||
return &CharacterView{
|
||||
Id: c.ID,
|
||||
Name: c.Name,
|
||||
Alias: c.Alias,
|
||||
@@ -31,7 +31,7 @@ func (c *Charactor) ToView() *CharactorView {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Charactor) Equal(other *Charactor) bool {
|
||||
func (c *Character) Equal(other *Character) bool {
|
||||
if c.Name != other.Name || c.CV != other.CV || c.Role != other.Role || c.ImageID != other.ImageID {
|
||||
return false
|
||||
}
|
||||
@@ -23,7 +23,7 @@ type Resource struct {
|
||||
ModifiedTime time.Time
|
||||
Gallery []uint `gorm:"serializer:json"`
|
||||
GalleryNsfw []uint `gorm:"serializer:json"`
|
||||
Charactors []Charactor `gorm:"foreignKey:ResourceID"`
|
||||
Characters []Character `gorm:"foreignKey:ResourceID"`
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
@@ -57,7 +57,7 @@ type ResourceDetailView struct {
|
||||
Related []ResourceView `json:"related"`
|
||||
Gallery []uint `json:"gallery"`
|
||||
GalleryNsfw []uint `json:"galleryNsfw"`
|
||||
Charactors []CharactorView `json:"charactors"`
|
||||
Characters []CharacterView `json:"characters"`
|
||||
}
|
||||
|
||||
func (r *Resource) ToView() ResourceView {
|
||||
@@ -96,9 +96,9 @@ func (r *Resource) ToDetailView() ResourceDetailView {
|
||||
for i, file := range r.Files {
|
||||
files[i] = *file.ToView()
|
||||
}
|
||||
charactors := make([]CharactorView, len(r.Charactors))
|
||||
for i, charactor := range r.Charactors {
|
||||
charactors[i] = *charactor.ToView()
|
||||
characters := make([]CharacterView, len(r.Characters))
|
||||
for i, character := range r.Characters {
|
||||
characters[i] = *character.ToView()
|
||||
}
|
||||
return ResourceDetailView{
|
||||
ID: r.ID,
|
||||
@@ -116,6 +116,6 @@ func (r *Resource) ToDetailView() ResourceDetailView {
|
||||
Comments: r.Comments,
|
||||
Gallery: r.Gallery,
|
||||
GalleryNsfw: r.GalleryNsfw,
|
||||
Charactors: charactors,
|
||||
Characters: characters,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user