-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple distance locations (#155)
* Add support for multiple distance locations * Fix migration * Update 7.sql * Update 7.sql * Add per subscription location * comments * - Add support for handling enabling/disabling specific subscription types or all. - Update migration 7.
- Loading branch information
Showing
13 changed files
with
351 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ALTER TABLE `subscriptions` | ||
DROP COLUMN `distance`; | ||
|
||
ALTER TABLE `subscriptions` | ||
DROP COLUMN `latitude`; | ||
|
||
ALTER TABLE `subscriptions` | ||
DROP COLUMN `longitude`; | ||
|
||
ALTER TABLE `subscriptions` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `pokemon` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `pvp` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `raids` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `quests` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `invasions` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `lures` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
ALTER TABLE `gyms` | ||
ADD COLUMN `location` varchar(32) DEFAULT NULL; | ||
|
||
CREATE TABLE `locations` ( | ||
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`subscription_id` int(11) NOT NULL DEFAULT 0, | ||
`guild_id` bigint(20) DEFAULT NULL, | ||
`user_id` bigint(20) DEFAULT NULL, | ||
`name` varchar(32) NOT NULL, | ||
`distance` int(11) DEFAULT 0, | ||
`latitude` double DEFAULT 0, | ||
`longitude` double DEFAULT 0, | ||
PRIMARY KEY (`id`), | ||
KEY `FK_location_subscriptions_subscription_id` (`subscription_id`), | ||
CONSTRAINT `FK_location_subscriptions_subscription_id` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) | ||
); | ||
|
||
ALTER TABLE `subscriptions` | ||
DROP COLUMN `enabled`; | ||
|
||
ALTER TABLE `subscriptions` | ||
ADD COLUMN `status` smallint(5) unsigned DEFAULT 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
namespace WhMgr.Data.Subscriptions.Models | ||
{ | ||
using Newtonsoft.Json; | ||
using ServiceStack.DataAnnotations; | ||
|
||
[ | ||
JsonObject("locations"), | ||
Alias("locations"), | ||
] | ||
public class LocationSubscription : SubscriptionItem | ||
{ | ||
[ | ||
Alias("subscription_id"), | ||
ForeignKey(typeof(SubscriptionObject)), | ||
] | ||
public int SubscriptionId { get; set; } | ||
|
||
[ | ||
JsonProperty("name"), | ||
Alias("name"), | ||
] | ||
public string Name { get; set; } | ||
|
||
[ | ||
JsonProperty("distance"), | ||
Alias("distance"), | ||
Default(0), | ||
] | ||
public int DistanceM { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the latitude to use with distance checks | ||
/// </summary> | ||
[ | ||
JsonProperty("latitude"), | ||
Alias("latitude"), | ||
Default(0), | ||
] | ||
public double Longitude { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the longitude to use with distance checks | ||
/// </summary> | ||
[ | ||
JsonProperty("longitude"), | ||
Alias("longitude"), | ||
Default(0), | ||
] | ||
public double Latitude { get; set; } | ||
} | ||
} |
Oops, something went wrong.