Skip to content

Commit

Permalink
Merge pull request #401 from sparcs-kaist/refactor/model-fields
Browse files Browse the repository at this point in the history
Refactor model fields
  • Loading branch information
injoonH authored Oct 5, 2023
2 parents 7fdc743 + 41aa08b commit f5b7e92
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Generated by Django 4.2.3 on 2023-07-31 12:00

import apps.core.models.board
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0055_remove_board_group_id_board_group"),
]

operations = [
migrations.AlterField(
model_name="article",
name="comment_count",
field=models.PositiveIntegerField(default=0, verbose_name="댓글 수"),
),
migrations.AlterField(
model_name="article",
name="hit_count",
field=models.PositiveIntegerField(default=0, verbose_name="조회수"),
),
migrations.AlterField(
model_name="article",
name="migrated_hit_count",
field=models.PositiveIntegerField(default=0, verbose_name="이전된 조회수"),
),
migrations.AlterField(
model_name="article",
name="migrated_negative_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="이전된 싫어요 수"),
),
migrations.AlterField(
model_name="article",
name="migrated_positive_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="이전된 좋아요 수"),
),
migrations.AlterField(
model_name="article",
name="name_type",
field=models.PositiveSmallIntegerField(
default=apps.core.models.board.NameType["REGULAR"],
verbose_name="익명 혹은 실명 여부",
),
),
migrations.AlterField(
model_name="article",
name="negative_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="싫어요 수"),
),
migrations.AlterField(
model_name="article",
name="positive_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="좋아요 수"),
),
migrations.AlterField(
model_name="article",
name="report_count",
field=models.PositiveIntegerField(default=0, verbose_name="신고 수"),
),
migrations.AlterField(
model_name="board",
name="top_threshold",
field=models.PositiveSmallIntegerField(
default=10, verbose_name="인기글 달성 기준 좋아요 개수"
),
),
migrations.AlterField(
model_name="comment",
name="negative_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="싫어요 수"),
),
migrations.AlterField(
model_name="comment",
name="positive_vote_count",
field=models.PositiveIntegerField(default=0, verbose_name="좋아요 수"),
),
migrations.AlterField(
model_name="comment",
name="report_count",
field=models.PositiveIntegerField(default=0, verbose_name="신고 수"),
),
]
18 changes: 9 additions & 9 deletions apps/core/models/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Article(MetaDataModel):
verbose_name="text 형식 본문",
editable=False,
)
name_type = models.SmallIntegerField(
name_type = models.PositiveSmallIntegerField(
verbose_name="익명 혹은 실명 여부",
default=NameType.REGULAR,
)
Expand All @@ -61,35 +61,35 @@ class Article(MetaDataModel):
verbose_name="정치/사회성 내용",
default=False,
)
hit_count = models.IntegerField(
hit_count = models.PositiveIntegerField(
verbose_name="조회수",
default=0,
)
comment_count = models.IntegerField(
comment_count = models.PositiveIntegerField(
verbose_name="댓글 수",
default=0,
)
report_count = models.IntegerField(
report_count = models.PositiveIntegerField(
verbose_name="신고 수",
default=0,
)
positive_vote_count = models.IntegerField(
positive_vote_count = models.PositiveIntegerField(
verbose_name="좋아요 수",
default=0,
)
negative_vote_count = models.IntegerField(
negative_vote_count = models.PositiveIntegerField(
verbose_name="싫어요 수",
default=0,
)
migrated_hit_count = models.IntegerField(
migrated_hit_count = models.PositiveIntegerField(
verbose_name="이전된 조회수",
default=0,
)
migrated_positive_vote_count = models.IntegerField(
migrated_positive_vote_count = models.PositiveIntegerField(
verbose_name="이전된 좋아요 수",
default=0,
)
migrated_negative_vote_count = models.IntegerField(
migrated_negative_vote_count = models.PositiveIntegerField(
verbose_name="이전된 싫어요 수",
default=0,
)
Expand Down
2 changes: 1 addition & 1 deletion apps/core/models/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Board(MetaDataModel):
blank=True,
default="",
)
top_threshold = models.SmallIntegerField(
top_threshold = models.PositiveSmallIntegerField(
verbose_name="인기글 달성 기준 좋아요 개수",
default=10,
)
Expand Down
6 changes: 3 additions & 3 deletions apps/core/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class Meta(MetaDataModel.Meta):
verbose_name="익명 혹은 실명",
)

report_count = models.IntegerField(
report_count = models.PositiveIntegerField(
default=0,
verbose_name="신고 수",
)
positive_vote_count = models.IntegerField(
positive_vote_count = models.PositiveIntegerField(
default=0,
verbose_name="좋아요 수",
)
negative_vote_count = models.IntegerField(
negative_vote_count = models.PositiveIntegerField(
default=0,
verbose_name="싫어요 수",
)
Expand Down
6 changes: 4 additions & 2 deletions apps/user/models/user_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class UserGroup(models.IntegerChoices):
verbose_name="닉네임",
)
nickname_updated_at = models.DateTimeField(
default=MIN_TIME, verbose_name="최근 닉네임 변경일시"
default=MIN_TIME,
verbose_name="최근 닉네임 변경일시",
)
see_sexual = models.BooleanField(
default=False,
Expand All @@ -85,7 +86,8 @@ class UserGroup(models.IntegerChoices):
verbose_name="정치/사회성 보기",
)
group = models.IntegerField(
choices=UserGroup.choices, default=UserGroup.UNAUTHORIZED
choices=UserGroup.choices,
default=UserGroup.UNAUTHORIZED,
)
user = models.OneToOneField(
on_delete=models.CASCADE,
Expand Down

0 comments on commit f5b7e92

Please sign in to comment.