swe574-Fall2024-Group1 / huddleup

Community Specific Information Management project for swe574, Fall 2024 BOUN
0 stars 0 forks source link

Determine Badge-User Entity Relation #45

Open ustaoglumuharrem opened 3 weeks ago

ustaoglumuharrem commented 3 weeks ago

User-Badge relation have Many to Many

Models class Badge(models.Model): name = models.CharField(max_length=50, unique=True) description = models.CharField(max_length=200) icon = models.ImageField(upload_to='badges/icons/', blank=True, null=True) createdAt = models.DateTimeField(auto_now_add=True)

Model to assign badges to users (many-to-many relation) class UserBadge(models.Model): user = models.ForeignKey('authAPI.User', on_delete=models.CASCADE) badge = models.ForeignKey(Badge, on_delete=models.CASCADE) awardedAt = models.DateTimeField(auto_now_add=True)

ustaoglumuharrem commented 2 days ago

adding badgeType and badgeparameters(json) for badge model.