Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增更多帳號管理 API #38

Closed
KageRyo opened this issue Aug 12, 2024 · 2 comments
Closed

新增更多帳號管理 API #38

KageRyo opened this issue Aug 12, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@KageRyo
Copy link
Owner

KageRyo commented Aug 12, 2024

# GET : 查詢使用者 API /api/auth/user
# 以使用者的 username 查 user_type

# PUT : 更新使用者 API /api/auth/user
# 以使用者的 username 更新 user_type

# DELETE : 刪除使用者 API /api/auth/user
# 以使用者的 username 刪除使用者

新增以上三支 API

@KageRyo KageRyo added the enhancement New feature or request label Aug 12, 2024
@KageRyo KageRyo self-assigned this Aug 12, 2024
@KageRyo
Copy link
Owner Author

KageRyo commented Aug 12, 2024

可能要審視 models.py 內容是否要修改
因為目前在資料庫中儲存
import datetime

from django.contrib.auth.models import AbstractUser
from django.db import models

class User(AbstractUser):
USER_TYPE = (
(1, '一般使用者'),
(2, '管理員'),
)
user_type = models.IntegerField(choices=USER_TYPE, default=1) # 使用者類型

class Url(models.Model):
# 短網址相關欄位
origin_url = models.URLField()
short_string = models.CharField(max_length=10, unique=True, default='NULL')
short_url = models.URLField()
create_date = models.DateTimeField(default=datetime.datetime.now)
expire_date = models.DateTimeField(null=True, blank=True)
visit_count = models.IntegerField(default=0)
# 使用者相關欄位
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
這樣而已
沒有顯示出其他資訊?

@KageRyo
Copy link
Owner Author

KageRyo commented Aug 12, 2024

Issues 修復順序可能如下:

  1. 先至 models.py 增加需要使用到的資訊欄位
  2. 到 RyoURL-test 專案增加測試項目(確保所有大多數都有被測試到)
  3. 依照測試期望結果修改 api
  4. 回到 RyoURL-test 檢查是否通過測試

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant