mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2026-01-13 13:41:52 -08:00
Made groups singular; added EMD group creation under new preprocessor constant.
This commit is contained in:
parent
5e5a66bf92
commit
b900b88466
@ -82,20 +82,6 @@ public class GroupController : Controller {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
public static readonly Schema.Group EMD_Dragons = new Schema.Group {
|
|
||||||
GroupID = "8e68214a-c801-4759-8461-d01f28484134",
|
|
||||||
Name = "Dragons",
|
|
||||||
Color = "234,57,23",
|
|
||||||
Logo = "RS_DATA/Content/PlayerData/EMD/IcoEMDTeamDragons.png"
|
|
||||||
};
|
|
||||||
public static readonly Schema.Group EMD_Scorpions = new Schema.Group {
|
|
||||||
GroupID = "db0aa225-2f0e-424c-83a7-73783fe63fef",
|
|
||||||
Name = "Scorpions",
|
|
||||||
Color = "120,183,53",
|
|
||||||
Logo = "RS_DATA/Content/PlayerData/EMD/IcoEMDTeamScorpions.png"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
private readonly DBContext ctx;
|
private readonly DBContext ctx;
|
||||||
|
|
||||||
public GroupController(DBContext ctx) {
|
public GroupController(DBContext ctx) {
|
||||||
@ -109,7 +95,7 @@ public class GroupController : Controller {
|
|||||||
public IActionResult CreateGroup(Viking viking, [FromForm] string apiKey, [FromForm] string groupCreateRequest) {
|
public IActionResult CreateGroup(Viking viking, [FromForm] string apiKey, [FromForm] string groupCreateRequest) {
|
||||||
uint gameId = ClientVersion.GetGameID(apiKey);
|
uint gameId = ClientVersion.GetGameID(apiKey);
|
||||||
|
|
||||||
if (viking.GroupMemberships.Any(g => g.Group.GameID == gameId)) {
|
if (viking.GroupMembership != null) {
|
||||||
return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.CreatorIsNotApproved });
|
return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.CreatorIsNotApproved });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +107,7 @@ public class GroupController : Controller {
|
|||||||
//if (request.MaxMemberLimit < 4) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupMaxMemberLimitInvalid }); // Not actually used by the game.
|
//if (request.MaxMemberLimit < 4) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupMaxMemberLimitInvalid }); // Not actually used by the game.
|
||||||
if (request.Name.Length == 0) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupNameIsEmpty });
|
if (request.Name.Length == 0) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupNameIsEmpty });
|
||||||
if (request.Description.Length == 0) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupDescriptionIsEmpty });
|
if (request.Description.Length == 0) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupDescriptionIsEmpty });
|
||||||
if (viking.GroupMemberships.Any(g => g.Group.Name.Equals(request.Name, StringComparison.InvariantCultureIgnoreCase))) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupNameIsDuplicate });
|
if (ctx.Groups.Any(g => g.Name.Equals(request.Name, StringComparison.InvariantCultureIgnoreCase))) return Ok(new CreateGroupResult { Success = false, Status = CreateGroupStatus.GroupNameIsDuplicate });
|
||||||
|
|
||||||
Model.Group group = new Model.Group {
|
Model.Group group = new Model.Group {
|
||||||
Name = request.Name,
|
Name = request.Name,
|
||||||
@ -173,8 +159,8 @@ public class GroupController : Controller {
|
|||||||
EditGroupRequest request = XmlUtil.DeserializeXml<EditGroupRequest>(groupEditRequest);
|
EditGroupRequest request = XmlUtil.DeserializeXml<EditGroupRequest>(groupEditRequest);
|
||||||
request.Name = request.Name.Trim();
|
request.Name = request.Name.Trim();
|
||||||
|
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(gv => gv.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole == null) {
|
if (vikingRole == null || vikingRole.Group.GroupID.ToString() != request.GroupID) {
|
||||||
return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupNotFound });
|
return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupNotFound });
|
||||||
} else if (vikingRole.UserRole < UserRole.Elder) {
|
} else if (vikingRole.UserRole < UserRole.Elder) {
|
||||||
return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.PermissionDenied });
|
return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.PermissionDenied });
|
||||||
@ -185,7 +171,7 @@ public class GroupController : Controller {
|
|||||||
//if (request.MaxMemberLimit < 4) return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupMaxMemberLimitInvalid }); // Not actually used by the game.
|
//if (request.MaxMemberLimit < 4) return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupMaxMemberLimitInvalid }); // Not actually used by the game.
|
||||||
if ((request.Name?.Length ?? 0) == 0) request.Name = vikingRole.Group.Name;
|
if ((request.Name?.Length ?? 0) == 0) request.Name = vikingRole.Group.Name;
|
||||||
if ((request.Description?.Length ?? 0) == 0) request.Description = vikingRole.Group.Description;
|
if ((request.Description?.Length ?? 0) == 0) request.Description = vikingRole.Group.Description;
|
||||||
if (request.Name != vikingRole.Group.Name && viking.GroupMemberships.Any(gm => gm.Group.Name.Equals(request.Name, StringComparison.InvariantCultureIgnoreCase))) return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupNameIsDuplicate });
|
if (request.Name != vikingRole.Group.Name && ctx.Groups.Any(g => g.Name.Equals(request.Name, StringComparison.InvariantCultureIgnoreCase))) return Ok(new EditGroupResult { Success = false, Status = EditGroupStatus.GroupNameIsDuplicate });
|
||||||
|
|
||||||
vikingRole.Group.Name = request.Name;
|
vikingRole.Group.Name = request.Name;
|
||||||
vikingRole.Group.Description = request.Description;
|
vikingRole.Group.Description = request.Description;
|
||||||
@ -206,13 +192,14 @@ public class GroupController : Controller {
|
|||||||
[Route("GroupWebService.asmx/JoinGroup")]
|
[Route("GroupWebService.asmx/JoinGroup")]
|
||||||
[VikingSession]
|
[VikingSession]
|
||||||
public IActionResult JoinGroupV1(Viking viking, [FromForm] string apiKey, [FromForm] string groupID) {
|
public IActionResult JoinGroupV1(Viking viking, [FromForm] string apiKey, [FromForm] string groupID) {
|
||||||
|
Guid parsedGroupID = Guid.Parse(groupID);
|
||||||
uint gameId = ClientVersion.GetGameID(apiKey);
|
uint gameId = ClientVersion.GetGameID(apiKey);
|
||||||
|
|
||||||
// Check for loyalty.
|
// Check for loyalty.
|
||||||
if (viking.GroupMemberships.Any(g => g.Group.GameID == gameId)) {
|
if (viking.GroupMembership != null) {
|
||||||
return Ok(new JoinGroupResult { GroupStatus = GroupMembershipStatus.SELF_BLOCKED });
|
return Ok(new JoinGroupResult { GroupStatus = GroupMembershipStatus.SELF_BLOCKED });
|
||||||
}
|
}
|
||||||
Model.Group? group = ctx.Groups.FirstOrDefault(g => g.GroupID.ToString().Equals(groupID, StringComparison.OrdinalIgnoreCase));
|
Model.Group? group = ctx.Groups.FirstOrDefault(g => g.GroupID == parsedGroupID);
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
// This check is only on this side to prevent people from attempting to circumvent the join limit.
|
// This check is only on this side to prevent people from attempting to circumvent the join limit.
|
||||||
if (group.Type <= GroupType.System || group.Vikings.Count < group.MaxMemberLimit) {
|
if (group.Type <= GroupType.System || group.Vikings.Count < group.MaxMemberLimit) {
|
||||||
@ -236,13 +223,14 @@ public class GroupController : Controller {
|
|||||||
uint gameId = ClientVersion.GetGameID(apiKey);
|
uint gameId = ClientVersion.GetGameID(apiKey);
|
||||||
|
|
||||||
JoinGroupRequest request = XmlUtil.DeserializeXml<JoinGroupRequest>(groupJoinRequest);
|
JoinGroupRequest request = XmlUtil.DeserializeXml<JoinGroupRequest>(groupJoinRequest);
|
||||||
Model.Group? group = ctx.Groups.FirstOrDefault(g => g.GroupID.ToString() == request.GroupID.ToUpper());
|
Guid parsedGroupID = Guid.Parse(request.GroupID);
|
||||||
|
Model.Group? group = ctx.Groups.FirstOrDefault(g => g.GroupID == parsedGroupID);
|
||||||
if (group == null) return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.Error });
|
if (group == null) return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.Error });
|
||||||
if (group.Type >= GroupType.Private) {
|
if (group.Type >= GroupType.Private) {
|
||||||
return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.GroupTypeIsNotPublic });
|
return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.GroupTypeIsNotPublic });
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMember? existing = viking.GroupMemberships.FirstOrDefault(g => g.Group.GameID == gameId);
|
GroupMember? existing = viking.GroupMembership;
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
if (existing.Group == group)
|
if (existing.Group == group)
|
||||||
return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.UserAlreadyMemberOfTheGroup });
|
return Ok(new GroupJoinResult { Success = false, Status = JoinGroupStatus.UserAlreadyMemberOfTheGroup });
|
||||||
@ -283,8 +271,9 @@ public class GroupController : Controller {
|
|||||||
[VikingSession]
|
[VikingSession]
|
||||||
public IActionResult LeaveGroup(Viking viking, [FromForm] string groupLeaveRequest) {
|
public IActionResult LeaveGroup(Viking viking, [FromForm] string groupLeaveRequest) {
|
||||||
LeaveGroupRequest request = XmlUtil.DeserializeXml<LeaveGroupRequest>(groupLeaveRequest);
|
LeaveGroupRequest request = XmlUtil.DeserializeXml<LeaveGroupRequest>(groupLeaveRequest);
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(g => g.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole == null) return Ok(new LeaveGroupResult { Success = false, Status = LeaveGroupStatus.Error });
|
if (vikingRole == null || vikingRole.Group.GroupID.ToString() != request.GroupID)
|
||||||
|
return Ok(new LeaveGroupResult { Success = false, Status = LeaveGroupStatus.Error });
|
||||||
GroupMember? targetRole;
|
GroupMember? targetRole;
|
||||||
if (viking.Uid.ToString().Equals(request.UserID, StringComparison.CurrentCultureIgnoreCase)) {
|
if (viking.Uid.ToString().Equals(request.UserID, StringComparison.CurrentCultureIgnoreCase)) {
|
||||||
targetRole = vikingRole.Group.Vikings.FirstOrDefault(gv => gv.Viking == viking);
|
targetRole = vikingRole.Group.Vikings.FirstOrDefault(gv => gv.Viking == viking);
|
||||||
@ -311,7 +300,7 @@ public class GroupController : Controller {
|
|||||||
if (request.ForUserID != null) {
|
if (request.ForUserID != null) {
|
||||||
Viking? target = ctx.Vikings.FirstOrDefault(v => request.ForUserID.ToUpper() == v.Uid.ToString());
|
Viking? target = ctx.Vikings.FirstOrDefault(v => request.ForUserID.ToUpper() == v.Uid.ToString());
|
||||||
if (target == null) return Ok(new GetGroupsResult { Success = false });
|
if (target == null) return Ok(new GetGroupsResult { Success = false });
|
||||||
groups = target.GroupMemberships.Select(gv => gv.Group);
|
groups = [target.GroupMembership.Group];
|
||||||
} else {
|
} else {
|
||||||
groups = groups.Where(g => g.Type == GroupType.Public || g.Type == GroupType.MembersOnly);
|
groups = groups.Where(g => g.Type == GroupType.Public || g.Type == GroupType.MembersOnly);
|
||||||
}
|
}
|
||||||
@ -353,8 +342,8 @@ public class GroupController : Controller {
|
|||||||
[VikingSession]
|
[VikingSession]
|
||||||
public IActionResult RemoveMember(Viking viking, [FromForm] string removeMemberRequest) {
|
public IActionResult RemoveMember(Viking viking, [FromForm] string removeMemberRequest) {
|
||||||
RemoveMemberRequest request = XmlUtil.DeserializeXml<RemoveMemberRequest>(removeMemberRequest);
|
RemoveMemberRequest request = XmlUtil.DeserializeXml<RemoveMemberRequest>(removeMemberRequest);
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(g => g.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole == null)
|
if (vikingRole == null || vikingRole.GroupID.ToString() != request.GroupID)
|
||||||
return Ok(new RemoveMemberResult { Success = false, Status = RemoveMemberStatus.Error });
|
return Ok(new RemoveMemberResult { Success = false, Status = RemoveMemberStatus.Error });
|
||||||
|
|
||||||
if (vikingRole.UserRole < UserRole.Elder)
|
if (vikingRole.UserRole < UserRole.Elder)
|
||||||
@ -378,8 +367,8 @@ public class GroupController : Controller {
|
|||||||
uint gameId = ClientVersion.GetGameID(apiKey);
|
uint gameId = ClientVersion.GetGameID(apiKey);
|
||||||
|
|
||||||
AuthorizeJoinRequest request = XmlUtil.DeserializeXml<AuthorizeJoinRequest>(authorizeJoinRequest);
|
AuthorizeJoinRequest request = XmlUtil.DeserializeXml<AuthorizeJoinRequest>(authorizeJoinRequest);
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(g => g.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole == null)
|
if (vikingRole == null || vikingRole.GroupID.ToString() != request.GroupID)
|
||||||
return Ok(new AuthorizeJoinResult { Success = false, Status = AuthorizeJoinStatus.ApproverNotInThisGroup });
|
return Ok(new AuthorizeJoinResult { Success = false, Status = AuthorizeJoinStatus.ApproverNotInThisGroup });
|
||||||
|
|
||||||
if (vikingRole.UserRole < UserRole.Elder)
|
if (vikingRole.UserRole < UserRole.Elder)
|
||||||
@ -390,7 +379,7 @@ public class GroupController : Controller {
|
|||||||
return Ok(new AuthorizeJoinResult { Success = false, Status = AuthorizeJoinStatus.Error });
|
return Ok(new AuthorizeJoinResult { Success = false, Status = AuthorizeJoinStatus.Error });
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupMember? existing = target.GroupMemberships.FirstOrDefault(gm => gm.Group.GameID == gameId);
|
GroupMember? existing = target.GroupMembership;
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
return Ok(new AuthorizeJoinResult {
|
return Ok(new AuthorizeJoinResult {
|
||||||
Success = false,
|
Success = false,
|
||||||
@ -427,8 +416,8 @@ public class GroupController : Controller {
|
|||||||
[VikingSession]
|
[VikingSession]
|
||||||
public IActionResult AssignRole(Viking viking, [FromForm] string assignRoleRequest) {
|
public IActionResult AssignRole(Viking viking, [FromForm] string assignRoleRequest) {
|
||||||
AssignRoleRequest request = XmlUtil.DeserializeXml<AssignRoleRequest>(assignRoleRequest);
|
AssignRoleRequest request = XmlUtil.DeserializeXml<AssignRoleRequest>(assignRoleRequest);
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(g => g.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole == null)
|
if (vikingRole == null || vikingRole.GroupID.ToString() != request.GroupID)
|
||||||
return Ok(new AssignRoleResult { Success = false, Status = AssignRoleStatus.ApproverNotMemberOfTheGroup });
|
return Ok(new AssignRoleResult { Success = false, Status = AssignRoleStatus.ApproverNotMemberOfTheGroup });
|
||||||
|
|
||||||
if (vikingRole.UserRole < UserRole.Elder)
|
if (vikingRole.UserRole < UserRole.Elder)
|
||||||
@ -465,8 +454,8 @@ public class GroupController : Controller {
|
|||||||
[VikingSession]
|
[VikingSession]
|
||||||
public IActionResult GetPendingJoinRequests(Viking viking, [FromForm] string getPendingJoinRequest) {
|
public IActionResult GetPendingJoinRequests(Viking viking, [FromForm] string getPendingJoinRequest) {
|
||||||
GetPendingJoinRequest request = XmlUtil.DeserializeXml<GetPendingJoinRequest>(getPendingJoinRequest);
|
GetPendingJoinRequest request = XmlUtil.DeserializeXml<GetPendingJoinRequest>(getPendingJoinRequest);
|
||||||
GroupMember? vikingRole = viking.GroupMemberships.FirstOrDefault(g => g.Group.GroupID.ToString() == request.GroupID);
|
GroupMember? vikingRole = viking.GroupMembership;
|
||||||
if (vikingRole?.UserRole >= UserRole.Elder) {
|
if (vikingRole?.GroupID.ToString() == request.GroupID && vikingRole?.UserRole >= UserRole.Elder) {
|
||||||
return Ok(new GetPendingJoinResult {
|
return Ok(new GetPendingJoinResult {
|
||||||
Success = true,
|
Success = true,
|
||||||
Requests = vikingRole.Group.JoinRequests
|
Requests = vikingRole.Group.JoinRequests
|
||||||
@ -475,7 +464,7 @@ public class GroupController : Controller {
|
|||||||
UserID = r.Viking.Uid.ToString(),
|
UserID = r.Viking.Uid.ToString(),
|
||||||
GroupID = vikingRole.Group.GroupID.ToString(),
|
GroupID = vikingRole.Group.GroupID.ToString(),
|
||||||
StatusID = GroupJoinRequestStatus.Pending,
|
StatusID = GroupJoinRequestStatus.Pending,
|
||||||
Message = r.Message ?? "Hello! Please invite me to your Crew!" // Defualt from Math Blaster btw
|
Message = r.Message ?? "Hello! Please invite me to your Crew!" // Default from Math Blaster btw
|
||||||
};
|
};
|
||||||
req.FromUserID = req.UserID;
|
req.FromUserID = req.UserID;
|
||||||
return req;
|
return req;
|
||||||
@ -494,13 +483,16 @@ public class GroupController : Controller {
|
|||||||
Viking? viking = ctx.Vikings.FirstOrDefault(v => v.Uid.ToString() == userId);
|
Viking? viking = ctx.Vikings.FirstOrDefault(v => v.Uid.ToString() == userId);
|
||||||
if (viking == null) return [];
|
if (viking == null) return [];
|
||||||
|
|
||||||
return viking.GroupMemberships.Where(gm => gm.Group.GameID == gameId).Select(gm => new Schema.Group {
|
Model.Group? group = viking.GroupMembership.Group;
|
||||||
GroupID = gm.Group.GroupID.ToString(),
|
return [
|
||||||
Name = gm.Group.Name,
|
new Schema.Group {
|
||||||
Color = gm.Group.Color,
|
GroupID = group.GroupID.ToString(),
|
||||||
Logo = gm.Group.Logo,
|
Name = group.Name,
|
||||||
MemberLimit = gm.Group.MaxMemberLimit
|
Color = group.Color,
|
||||||
}).ToArray();
|
Logo = group.Logo,
|
||||||
|
MemberLimit = group.MaxMemberLimit
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -527,9 +519,9 @@ public class GroupController : Controller {
|
|||||||
[Produces("application/xml")]
|
[Produces("application/xml")]
|
||||||
[Route("GroupWebService.asmx/GetMembersByGroupID")]
|
[Route("GroupWebService.asmx/GetMembersByGroupID")]
|
||||||
public Schema.GroupMember[] GetMembersByGroupID([FromForm] string groupID) {
|
public Schema.GroupMember[] GetMembersByGroupID([FromForm] string groupID) {
|
||||||
groupID = groupID.ToUpper();
|
Guid parsedGroupID = Guid.Parse(groupID);
|
||||||
Model.Group? group = ctx.Groups.FirstOrDefault(
|
Model.Group? group = ctx.Groups.FirstOrDefault(
|
||||||
g => g.GroupID.ToString() == groupID
|
g => g.GroupID == parsedGroupID
|
||||||
);
|
);
|
||||||
if (group == null) return [];
|
if (group == null) return [];
|
||||||
|
|
||||||
|
|||||||
@ -152,23 +152,8 @@ public class ProfileController : Controller {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UserGameCurrency currency = achievementService.GetUserCurrency(viking);
|
UserGameCurrency currency = achievementService.GetUserCurrency(viking);
|
||||||
|
|
||||||
ICollection<GroupMember> groups = viking.GroupMemberships;
|
GroupMember? groupRole = viking.GroupMembership;
|
||||||
|
|
||||||
UserProfileGroupData[] groupData = new UserProfileGroupData[groups.Count];
|
|
||||||
int i = 0;
|
|
||||||
foreach (GroupMember role in groups) {
|
|
||||||
groupData[i] = new UserProfileGroupData {
|
|
||||||
GroupID = role.Group.GroupID.ToString(),
|
|
||||||
Name = role.Group.Name,
|
|
||||||
Color = role.Group.Color,
|
|
||||||
Logo = role.Group.Logo,
|
|
||||||
TypeID = (int)role.Group.Type,
|
|
||||||
RoleID = role.UserRole
|
|
||||||
};
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new UserProfileData {
|
return new UserProfileData {
|
||||||
ID = viking.Uid.ToString(),
|
ID = viking.Uid.ToString(),
|
||||||
AvatarInfo = avatar,
|
AvatarInfo = avatar,
|
||||||
@ -187,7 +172,15 @@ public class ProfileController : Controller {
|
|||||||
UserID = viking.Uid,
|
UserID = viking.Uid,
|
||||||
UserProfileTagID = 1
|
UserProfileTagID = 1
|
||||||
},
|
},
|
||||||
Groups = groupData
|
Groups = groupRole != null ? [
|
||||||
|
new UserProfileGroupData {
|
||||||
|
GroupID = groupRole.Group.GroupID.ToString(),
|
||||||
|
Name = groupRole.Group.Name,
|
||||||
|
Color = groupRole.Group.Color,
|
||||||
|
Logo = groupRole.Group.Logo,
|
||||||
|
TypeID = (int)groupRole.Group.Type,
|
||||||
|
RoleID = groupRole.UserRole
|
||||||
|
}] : new UserProfileGroupData[]{}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ public class DBContext : DbContext {
|
|||||||
builder.Entity<Viking>().HasOne(v => v.Neighborhood)
|
builder.Entity<Viking>().HasOne(v => v.Neighborhood)
|
||||||
.WithOne(e => e.Viking);
|
.WithOne(e => e.Viking);
|
||||||
|
|
||||||
builder.Entity<Viking>().HasMany(v => v.GroupMemberships)
|
builder.Entity<Viking>().HasOne(v => v.GroupMembership)
|
||||||
.WithOne(g => g.Viking);
|
.WithOne(g => g.Viking);
|
||||||
|
|
||||||
builder.Entity<Viking>().HasMany(v => v.Ratings)
|
builder.Entity<Viking>().HasMany(v => v.Ratings)
|
||||||
@ -287,12 +287,36 @@ public class DBContext : DbContext {
|
|||||||
.HasForeignKey<Neighborhood>(e => e.VikingId);
|
.HasForeignKey<Neighborhood>(e => e.VikingId);
|
||||||
|
|
||||||
// Groups
|
// Groups
|
||||||
|
#if SEED_NON_SOD_DATA
|
||||||
|
builder.Entity<Group>().HasData(
|
||||||
|
new Model.Group {
|
||||||
|
Id = 1,
|
||||||
|
GroupID = new Guid("db0aa225-2f0e-424c-83a7-73783fe63fef"),
|
||||||
|
Name = "Dragons",
|
||||||
|
Color = "234,57,23",
|
||||||
|
Logo = "RS_DATA/Content/PlayerData/EMD/IcoEMDTeamDragons.png",
|
||||||
|
Type = Schema.GroupType.System,
|
||||||
|
GameID = Util.ClientVersion.EMD,
|
||||||
|
MaxMemberLimit = int.MaxValue
|
||||||
|
},
|
||||||
|
new Model.Group {
|
||||||
|
Id = 2,
|
||||||
|
GroupID = new Guid("db0aa225-2f0e-424c-83a7-73783fe63fef"),
|
||||||
|
Name = "Scorpions",
|
||||||
|
Color = "120,183,53",
|
||||||
|
Logo = "RS_DATA/Content/PlayerData/EMD/IcoEMDTeamScorpions.png",
|
||||||
|
Type = Schema.GroupType.System,
|
||||||
|
GameID = Util.ClientVersion.EMD,
|
||||||
|
MaxMemberLimit = int.MaxValue
|
||||||
|
}
|
||||||
|
);
|
||||||
|
#endif
|
||||||
builder.Entity<Group>().HasMany(r => r.Vikings)
|
builder.Entity<Group>().HasMany(r => r.Vikings)
|
||||||
.WithOne(v => v.Group);
|
.WithOne(v => v.Group);
|
||||||
builder.Entity<GroupMember>().HasOne(r => r.Group)
|
builder.Entity<GroupMember>().HasOne(r => r.Group)
|
||||||
.WithMany(g => g.Vikings);
|
.WithMany(g => g.Vikings);
|
||||||
builder.Entity<GroupMember>().HasOne(r => r.Viking)
|
builder.Entity<GroupMember>().HasOne(r => r.Viking)
|
||||||
.WithMany(g => g.GroupMemberships);
|
.WithOne(g => g.GroupMembership);
|
||||||
builder.Entity<Group>().HasMany(r => r.JoinRequests)
|
builder.Entity<Group>().HasMany(r => r.JoinRequests)
|
||||||
.WithOne(r => r.Group);
|
.WithOne(r => r.Group);
|
||||||
builder.Entity<GroupJoinRequest>().HasOne(r => r.Group)
|
builder.Entity<GroupJoinRequest>().HasOne(r => r.Group)
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class Viking {
|
|||||||
public virtual ICollection<MMORole> MMORoles { get; set; } = null!;
|
public virtual ICollection<MMORole> MMORoles { get; set; } = null!;
|
||||||
public virtual Neighborhood? Neighborhood { get; set; } = null!;
|
public virtual Neighborhood? Neighborhood { get; set; } = null!;
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual ICollection<GroupMember> GroupMemberships { get; set; } = null!;
|
public virtual GroupMember? GroupMembership { get; set; } = null!;
|
||||||
public virtual ICollection<Rating> Ratings { get; set; } = null!;
|
public virtual ICollection<Rating> Ratings { get; set; } = null!;
|
||||||
public virtual Dragon? SelectedDragon { get; set; }
|
public virtual Dragon? SelectedDragon { get; set; }
|
||||||
public virtual ICollection<UserMissionData> UserMissions { get; set; } = null!;
|
public virtual ICollection<UserMissionData> UserMissions { get; set; } = null!;
|
||||||
|
|||||||
@ -8,6 +8,8 @@
|
|||||||
<DefineConstants>USE_SQLITE;$(DefineConstants)</DefineConstants>
|
<DefineConstants>USE_SQLITE;$(DefineConstants)</DefineConstants>
|
||||||
<DefineConstants>USE_POSTGRESQL;$(DefineConstants)</DefineConstants>
|
<DefineConstants>USE_POSTGRESQL;$(DefineConstants)</DefineConstants>
|
||||||
<DefineConstants>USE_MYSQL;$(DefineConstants)</DefineConstants>
|
<DefineConstants>USE_MYSQL;$(DefineConstants)</DefineConstants>
|
||||||
|
|
||||||
|
<!--<DefineConstants>SEED_NON_SOD_DATA;$(DefineConstants)</DefineConstants>--> <!-- Currently just EMD Groups -->
|
||||||
|
|
||||||
<NoWarn>8600,8601,8602,8603,8604,8618,8625,8629</NoWarn>
|
<NoWarn>8600,8601,8602,8603,8604,8618,8625,8629</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user