Skip to content

Commit

Permalink
Merge branch 'main' of github.com:stevebrownlee/learn-ops-api
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebrownlee committed Jul 23, 2024
2 parents 4b50c70 + 3686750 commit d826782
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LearningAPI/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ class CapstoneTimelineAdmin(admin.ModelAdmin):
@admin.register(NssUserCohort)
class NssUserCohortAdmin(admin.ModelAdmin):
"""For assigning students to cohorts"""
list_display = ('nss_user', 'cohort',)
list_display = ('nss_user', 'cohort', 'is_github_org_member')
search_fields = ["nss_user__user__last_name"]
ordering = ('-pk',)
search_help_text = "Search by last name"

@admin.register(StudentTag)
Expand Down
1 change: 1 addition & 0 deletions LearningAPI/views/student_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ def assess(self, request, pk):
try:
existing_assessment = StudentAssessment.objects.get(student=student, assessment=assessment)
assessment_uri = request.build_absolute_uri(f'/assessments/{existing_assessment.id}')

return Response(
{ 'message': f'Conflict: {student.full_name} is already assigned to the {assessment.name} assessment' },
status=status.HTTP_409_CONFLICT,
Expand Down
105 changes: 105 additions & 0 deletions bangazon.dbml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
Table Order {
Id int PK
PaymentTypeId int
CustomerId int
CreatedAt datetime
}

Table Product {
Id int PK
Name varchar(50)
CustomerId int
Price decimal
Description varchar(255)
Quantity int
Location varchar(75)
ImagePath varchar(255)
CreatedAt datetime
ProductCategoryId int
}

Table ProductCategory {
Id int pk
Name varchar(55)
}

Table OrderProduct {
OrderProductId int PK
OrderId int
ProductId int
}

Table Customer {
Id int PK
FirstName varchar(55)
LastName varchar(55)
Email varchar(55)
CreatedAt datetime
IsActive boolean
}

Table ProductRating {
Id int pk
CustomerId int
ProductId int
Score int
}

Ref FK_OrderProduct_Order {
OrderProduct.OrderId > Order.Id
}

Ref FK_OrderProduct_Product {
OrderProduct.ProductId > Product.Id
}

Ref FK_Product_Merchant {
Product.CustomerId > Customer.Id
}

Table PaymentType {
PaymentTypeId int PK
MerchantName varchar(25)
AcctNumber varchar(25)
ExpirationDate datetime
CustomerId int
CreatedAt datetime
}

Table Favorite {
Id int PK
CustomerId int
SellerId int
}


Table Recommendation {
Id int PK
RecommenderId int
CustomerId int
ProductId int
}

Ref FK_OrderPaymentType{
Order.PaymentTypeId > PaymentType.PaymentTypeId
}

Ref FK_OrderCustomer{
Order.CustomerId > Customer.Id
}

Ref: "Customer"."Id" < "ProductRating"."CustomerId"

Ref: "Product"."Id" < "ProductRating"."ProductId"

Ref: "Customer"."Id" < "Favorite"."CustomerId"

Ref: "Customer"."Id" < "Favorite"."SellerId"

Ref: "Customer"."Id" < "Recommendation"."RecommenderId"

Ref: "Customer"."Id" < "Recommendation"."CustomerId"

Ref: "Product"."Id" < "Recommendation"."ProductId"

Ref: "ProductCategory"."Id" < "Product"."ProductCategoryId"

0 comments on commit d826782

Please sign in to comment.