LeneS 5 years ago
parent
commit
0b55814034

+ 8
- 2
UnivateProperties_API/Controllers/Properties/PropertyController.cs View File

@@ -30,8 +30,8 @@ namespace UnivateProperties_API.Controllers.Properties
30 30
             return new OkObjectResult(_Repo.GetDetailed(x => x.Id == id));
31 31
         }
32 32
 
33
-        [HttpGet("search/{type}/{keyword}")]
34
-        public IActionResult Get(string type, string Keyword)
33
+        [HttpGet("search/{keyword}")]
34
+        public IActionResult Search(string Keyword)
35 35
         {
36 36
             return new OkObjectResult(_Repo.GetDisplay(Keyword));
37 37
         }
@@ -42,6 +42,12 @@ namespace UnivateProperties_API.Controllers.Properties
42 42
             return new OkObjectResult(_Repo.GetDisplay(type, propertyType, province, city, suburb, propType));
43 43
         }
44 44
 
45
+        [HttpGet("latestProperties")]
46
+        public IActionResult GetLatestProperties()
47
+        {
48
+            return new OkObjectResult(_Repo.GetLatestDisplay());
49
+        }
50
+
45 51
         [HttpGet("{type}/{by}")]
46 52
         public IActionResult SearchBy(string type, string by)
47 53
         {

+ 775
- 0
UnivateProperties_API/Migrations/20190903062247_initial.Designer.cs View File

@@ -0,0 +1,775 @@
1
+// <auto-generated />
2
+using System;
3
+using Microsoft.EntityFrameworkCore;
4
+using Microsoft.EntityFrameworkCore.Infrastructure;
5
+using Microsoft.EntityFrameworkCore.Migrations;
6
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
8
+using UnivateProperties_API.Context;
9
+
10
+namespace UnivateProperties_API.Migrations
11
+{
12
+    [DbContext(typeof(DataContext))]
13
+    [Migration("20190903062247_initial")]
14
+    partial class initial
15
+    {
16
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
+        {
18
+#pragma warning disable 612, 618
19
+            modelBuilder
20
+                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
21
+                .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
22
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
23
+
24
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
25
+                {
26
+                    b.Property<int>("Id")
27
+                        .ValueGeneratedOnAdd();
28
+
29
+                    b.Property<string>("BCC");
30
+
31
+                    b.Property<string>("Body");
32
+
33
+                    b.Property<string>("CC");
34
+
35
+                    b.Property<string>("Comment");
36
+
37
+                    b.Property<DateTime>("Created");
38
+
39
+                    b.Property<bool>("IsBodyHtml");
40
+
41
+                    b.Property<DateTime>("Modified");
42
+
43
+                    b.Property<string>("ModifiedBy");
44
+
45
+                    b.Property<int>("SenderId");
46
+
47
+                    b.Property<string>("Subject");
48
+
49
+                    b.Property<string>("To");
50
+
51
+                    b.Property<string>("ToDisplay");
52
+
53
+                    b.HasKey("Id");
54
+
55
+                    b.HasIndex("SenderId");
56
+
57
+                    b.ToTable("Emails");
58
+                });
59
+
60
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
61
+                {
62
+                    b.Property<int>("Id")
63
+                        .ValueGeneratedOnAdd();
64
+
65
+                    b.Property<string>("Address");
66
+
67
+                    b.Property<DateTime>("Created");
68
+
69
+                    b.Property<string>("DisplayName");
70
+
71
+                    b.Property<DateTime>("Modified");
72
+
73
+                    b.Property<string>("ModifiedBy");
74
+
75
+                    b.Property<int>("SMTPHostId");
76
+
77
+                    b.HasKey("Id");
78
+
79
+                    b.HasIndex("SMTPHostId");
80
+
81
+                    b.ToTable("Accounts");
82
+                });
83
+
84
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPHost", b =>
85
+                {
86
+                    b.Property<int>("Id")
87
+                        .ValueGeneratedOnAdd();
88
+
89
+                    b.Property<DateTime>("Created");
90
+
91
+                    b.Property<string>("Host");
92
+
93
+                    b.Property<DateTime>("Modified");
94
+
95
+                    b.Property<string>("ModifiedBy");
96
+
97
+                    b.Property<bool>("NeedsAuthorize");
98
+
99
+                    b.Property<string>("Password");
100
+
101
+                    b.Property<bool>("UseSSL");
102
+
103
+                    b.Property<string>("User");
104
+
105
+                    b.HasKey("Id");
106
+
107
+                    b.ToTable("Hosts");
108
+                });
109
+
110
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
111
+                {
112
+                    b.Property<int>("Id")
113
+                        .ValueGeneratedOnAdd();
114
+
115
+                    b.Property<string>("AddressLine1");
116
+
117
+                    b.Property<string>("AddressLine2");
118
+
119
+                    b.Property<string>("AddressLine3");
120
+
121
+                    b.Property<int>("CityId");
122
+
123
+                    b.Property<DateTime>("Created");
124
+
125
+                    b.Property<string>("CreatedBy");
126
+
127
+                    b.Property<string>("Description");
128
+
129
+                    b.Property<bool>("IsSale");
130
+
131
+                    b.Property<DateTime>("Modified");
132
+
133
+                    b.Property<string>("ModifiedBy");
134
+
135
+                    b.Property<decimal>("OperationalCosts");
136
+
137
+                    b.Property<decimal>("Price");
138
+
139
+                    b.Property<string>("PricePer");
140
+
141
+                    b.Property<string>("PropertyName");
142
+
143
+                    b.Property<int>("PropertyTypeId");
144
+
145
+                    b.Property<int>("ProvinceId");
146
+
147
+                    b.Property<bool>("Published");
148
+
149
+                    b.Property<string>("ShortDescription");
150
+
151
+                    b.Property<int>("SuburbId");
152
+
153
+                    b.Property<string>("Unit");
154
+
155
+                    b.HasKey("Id");
156
+
157
+                    b.HasIndex("CityId");
158
+
159
+                    b.HasIndex("PropertyTypeId");
160
+
161
+                    b.HasIndex("ProvinceId");
162
+
163
+                    b.HasIndex("SuburbId");
164
+
165
+                    b.ToTable("Properties");
166
+                });
167
+
168
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
169
+                {
170
+                    b.Property<int>("Id")
171
+                        .ValueGeneratedOnAdd();
172
+
173
+                    b.Property<DateTime>("Created");
174
+
175
+                    b.Property<string>("Image");
176
+
177
+                    b.Property<bool>("IsDefault");
178
+
179
+                    b.Property<DateTime>("Modified");
180
+
181
+                    b.Property<string>("ModifiedBy");
182
+
183
+                    b.Property<int>("PropertyId");
184
+
185
+                    b.HasKey("Id");
186
+
187
+                    b.HasIndex("PropertyId");
188
+
189
+                    b.ToTable("PropertyImages");
190
+                });
191
+
192
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyType", b =>
193
+                {
194
+                    b.Property<int>("Id")
195
+                        .ValueGeneratedOnAdd();
196
+
197
+                    b.Property<DateTime>("Created");
198
+
199
+                    b.Property<string>("Description");
200
+
201
+                    b.Property<DateTime>("Modified");
202
+
203
+                    b.Property<string>("ModifiedBy");
204
+
205
+                    b.Property<int>("UsageType");
206
+
207
+                    b.HasKey("Id");
208
+
209
+                    b.ToTable("PropertyTypes");
210
+                });
211
+
212
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
213
+                {
214
+                    b.Property<int>("Id")
215
+                        .ValueGeneratedOnAdd();
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<string>("Description");
220
+
221
+                    b.Property<DateTime>("Modified");
222
+
223
+                    b.Property<string>("ModifiedBy");
224
+
225
+                    b.Property<int>("PropertyId");
226
+
227
+                    b.Property<int>("UserDefinedFieldId");
228
+
229
+                    b.Property<string>("Value");
230
+
231
+                    b.HasKey("Id");
232
+
233
+                    b.HasIndex("PropertyId");
234
+
235
+                    b.HasIndex("UserDefinedFieldId");
236
+
237
+                    b.ToTable("PropertyUserFields");
238
+                });
239
+
240
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
241
+                {
242
+                    b.Property<int>("Id")
243
+                        .ValueGeneratedOnAdd();
244
+
245
+                    b.Property<DateTime>("Created");
246
+
247
+                    b.Property<string>("FieldName");
248
+
249
+                    b.Property<string>("FieldType");
250
+
251
+                    b.Property<int>("GroupId");
252
+
253
+                    b.Property<DateTime>("Modified");
254
+
255
+                    b.Property<string>("ModifiedBy");
256
+
257
+                    b.Property<int>("Rank");
258
+
259
+                    b.HasKey("Id");
260
+
261
+                    b.HasIndex("GroupId");
262
+
263
+                    b.ToTable("UserDefinedFields");
264
+                });
265
+
266
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedGroup", b =>
267
+                {
268
+                    b.Property<int>("Id")
269
+                        .ValueGeneratedOnAdd();
270
+
271
+                    b.Property<DateTime>("Created");
272
+
273
+                    b.Property<string>("Description");
274
+
275
+                    b.Property<DateTime>("Modified");
276
+
277
+                    b.Property<string>("ModifiedBy");
278
+
279
+                    b.Property<int>("Rank");
280
+
281
+                    b.Property<int>("UsageType");
282
+
283
+                    b.HasKey("Id");
284
+
285
+                    b.ToTable("UserDefinedGroups");
286
+                });
287
+
288
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
289
+                {
290
+                    b.Property<int>("Id")
291
+                        .ValueGeneratedOnAdd();
292
+
293
+                    b.Property<string>("Code");
294
+
295
+                    b.Property<DateTime>("Created");
296
+
297
+                    b.Property<string>("Description");
298
+
299
+                    b.Property<DateTime>("Modified");
300
+
301
+                    b.Property<string>("ModifiedBy");
302
+
303
+                    b.Property<int>("ProvinceId");
304
+
305
+                    b.HasKey("Id");
306
+
307
+                    b.HasIndex("ProvinceId");
308
+
309
+                    b.ToTable("Cities");
310
+                });
311
+
312
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Province", b =>
313
+                {
314
+                    b.Property<int>("Id")
315
+                        .ValueGeneratedOnAdd();
316
+
317
+                    b.Property<string>("Code");
318
+
319
+                    b.Property<DateTime>("Created");
320
+
321
+                    b.Property<string>("Description");
322
+
323
+                    b.Property<DateTime>("Modified");
324
+
325
+                    b.Property<string>("ModifiedBy");
326
+
327
+                    b.HasKey("Id");
328
+
329
+                    b.ToTable("Provinces");
330
+                });
331
+
332
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
333
+                {
334
+                    b.Property<int>("Id")
335
+                        .ValueGeneratedOnAdd();
336
+
337
+                    b.Property<int>("CityId");
338
+
339
+                    b.Property<DateTime>("Created");
340
+
341
+                    b.Property<string>("Description");
342
+
343
+                    b.Property<DateTime>("Modified");
344
+
345
+                    b.Property<string>("ModifiedBy");
346
+
347
+                    b.Property<string>("PostalCode");
348
+
349
+                    b.HasKey("Id");
350
+
351
+                    b.HasIndex("CityId");
352
+
353
+                    b.ToTable("Suburbs");
354
+                });
355
+
356
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Season", b =>
357
+                {
358
+                    b.Property<int>("Id")
359
+                        .ValueGeneratedOnAdd();
360
+
361
+                    b.Property<DateTime>("Created");
362
+
363
+                    b.Property<DateTime>("Modified");
364
+
365
+                    b.Property<string>("ModifiedBy");
366
+
367
+                    b.Property<string>("Name");
368
+
369
+                    b.HasKey("Id");
370
+
371
+                    b.ToTable("Seasons");
372
+                });
373
+
374
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Status", b =>
375
+                {
376
+                    b.Property<int>("Id")
377
+                        .ValueGeneratedOnAdd();
378
+
379
+                    b.Property<string>("Code");
380
+
381
+                    b.Property<DateTime>("Created");
382
+
383
+                    b.Property<string>("Description");
384
+
385
+                    b.Property<DateTime>("Modified");
386
+
387
+                    b.Property<string>("ModifiedBy");
388
+
389
+                    b.Property<int>("StatusType");
390
+
391
+                    b.HasKey("Id");
392
+
393
+                    b.ToTable("Status");
394
+                });
395
+
396
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
397
+                {
398
+                    b.Property<int>("Id")
399
+                        .ValueGeneratedOnAdd();
400
+
401
+                    b.Property<int?>("AgencyId");
402
+
403
+                    b.Property<int?>("AgentId");
404
+
405
+                    b.Property<DateTime>("ArrivalDate");
406
+
407
+                    b.Property<string>("BankedWith");
408
+
409
+                    b.Property<int>("Bedrooms");
410
+
411
+                    b.Property<DateTime>("Created");
412
+
413
+                    b.Property<bool>("CurrentYearBanked");
414
+
415
+                    b.Property<DateTime>("DepartureDate");
416
+
417
+                    b.Property<bool>("LeviesPaidInFull");
418
+
419
+                    b.Property<double>("LevyAmount");
420
+
421
+                    b.Property<int>("MaxSleep");
422
+
423
+                    b.Property<DateTime>("Modified");
424
+
425
+                    b.Property<string>("ModifiedBy");
426
+
427
+                    b.Property<string>("Module");
428
+
429
+                    b.Property<DateTime>("OriginalPurchaseDate");
430
+
431
+                    b.Property<double>("OriginalPurchasePrice");
432
+
433
+                    b.Property<bool>("OtherResort");
434
+
435
+                    b.Property<int>("OwnerId");
436
+
437
+                    b.Property<bool>("ReferedByAgent");
438
+
439
+                    b.Property<int>("RegionId");
440
+
441
+                    b.Property<string>("ResortCode");
442
+
443
+                    b.Property<string>("ResortName");
444
+
445
+                    b.Property<string>("Season");
446
+
447
+                    b.Property<int>("StatusId");
448
+
449
+                    b.Property<string>("WeekNumber");
450
+
451
+                    b.Property<bool>("WeekPlacedForRental");
452
+
453
+                    b.HasKey("Id");
454
+
455
+                    b.HasIndex("AgencyId");
456
+
457
+                    b.HasIndex("AgentId");
458
+
459
+                    b.HasIndex("OwnerId");
460
+
461
+                    b.HasIndex("RegionId");
462
+
463
+                    b.HasIndex("StatusId");
464
+
465
+                    b.ToTable("Weeks");
466
+                });
467
+
468
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfiguration", b =>
469
+                {
470
+                    b.Property<int>("Id")
471
+                        .ValueGeneratedOnAdd();
472
+
473
+                    b.Property<int>("Adults");
474
+
475
+                    b.Property<int>("Bedrooms");
476
+
477
+                    b.Property<int>("Children");
478
+
479
+                    b.Property<string>("Code");
480
+
481
+                    b.Property<DateTime>("Created");
482
+
483
+                    b.Property<DateTime>("Modified");
484
+
485
+                    b.Property<string>("ModifiedBy");
486
+
487
+                    b.HasKey("Id");
488
+
489
+                    b.HasIndex("Code")
490
+                        .IsUnique();
491
+
492
+                    b.ToTable("UnitConfigurations");
493
+                });
494
+
495
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
496
+                {
497
+                    b.Property<int>("Id")
498
+                        .ValueGeneratedOnAdd();
499
+
500
+                    b.Property<DateTime>("Created");
501
+
502
+                    b.Property<string>("Description");
503
+
504
+                    b.Property<DateTime>("Modified");
505
+
506
+                    b.Property<string>("ModifiedBy");
507
+
508
+                    b.Property<int>("UnitConfigurationId");
509
+
510
+                    b.HasKey("Id");
511
+
512
+                    b.HasIndex("UnitConfigurationId");
513
+
514
+                    b.ToTable("UnitConfigurationTypes");
515
+                });
516
+
517
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agency", b =>
518
+                {
519
+                    b.Property<int>("Id")
520
+                        .ValueGeneratedOnAdd();
521
+
522
+                    b.Property<string>("AgencyName");
523
+
524
+                    b.Property<string>("CompanyRegNumber");
525
+
526
+                    b.Property<DateTime>("Created");
527
+
528
+                    b.Property<string>("EAABEFFCNumber");
529
+
530
+                    b.Property<DateTime>("Modified");
531
+
532
+                    b.Property<string>("ModifiedBy");
533
+
534
+                    b.HasKey("Id");
535
+
536
+                    b.ToTable("Agencies");
537
+                });
538
+
539
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
540
+                {
541
+                    b.Property<int>("Id")
542
+                        .ValueGeneratedOnAdd();
543
+
544
+                    b.Property<int?>("AgencyId");
545
+
546
+                    b.Property<string>("CellNumber");
547
+
548
+                    b.Property<DateTime>("Created");
549
+
550
+                    b.Property<string>("Email");
551
+
552
+                    b.Property<DateTime>("Modified");
553
+
554
+                    b.Property<string>("ModifiedBy");
555
+
556
+                    b.Property<string>("Name");
557
+
558
+                    b.Property<string>("Surname");
559
+
560
+                    b.Property<string>("Telephone");
561
+
562
+                    b.Property<int>("UserId");
563
+
564
+                    b.HasKey("Id");
565
+
566
+                    b.HasIndex("AgencyId");
567
+
568
+                    b.HasIndex("UserId");
569
+
570
+                    b.ToTable("Agents");
571
+                });
572
+
573
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
574
+                {
575
+                    b.Property<int>("Id")
576
+                        .ValueGeneratedOnAdd();
577
+
578
+                    b.Property<string>("CellNumber");
579
+
580
+                    b.Property<DateTime>("Created");
581
+
582
+                    b.Property<string>("Email");
583
+
584
+                    b.Property<DateTime>("Modified");
585
+
586
+                    b.Property<string>("ModifiedBy");
587
+
588
+                    b.Property<string>("Name");
589
+
590
+                    b.Property<string>("Surname");
591
+
592
+                    b.Property<string>("Telephone");
593
+
594
+                    b.Property<int>("UserId");
595
+
596
+                    b.HasKey("Id");
597
+
598
+                    b.HasIndex("UserId");
599
+
600
+                    b.ToTable("Individuals");
601
+                });
602
+
603
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.User", b =>
604
+                {
605
+                    b.Property<int>("Id")
606
+                        .ValueGeneratedOnAdd();
607
+
608
+                    b.Property<DateTime>("Created");
609
+
610
+                    b.Property<DateTime>("Modified");
611
+
612
+                    b.Property<string>("ModifiedBy");
613
+
614
+                    b.Property<string>("Name");
615
+
616
+                    b.Property<byte[]>("PasswordHash");
617
+
618
+                    b.Property<byte[]>("PasswordSalt");
619
+
620
+                    b.Property<string>("Role");
621
+
622
+                    b.Property<string>("Surname");
623
+
624
+                    b.Property<string>("Token");
625
+
626
+                    b.Property<string>("Username");
627
+
628
+                    b.Property<bool>("Verified");
629
+
630
+                    b.HasKey("Id");
631
+
632
+                    b.ToTable("Users");
633
+                });
634
+
635
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
636
+                {
637
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPAccount", "Sender")
638
+                        .WithMany("Emails")
639
+                        .HasForeignKey("SenderId")
640
+                        .OnDelete(DeleteBehavior.Cascade);
641
+                });
642
+
643
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
644
+                {
645
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPHost", "SMTPHost")
646
+                        .WithMany("SMTPAccounts")
647
+                        .HasForeignKey("SMTPHostId")
648
+                        .OnDelete(DeleteBehavior.Cascade);
649
+                });
650
+
651
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
652
+                {
653
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
654
+                        .WithMany()
655
+                        .HasForeignKey("CityId")
656
+                        .OnDelete(DeleteBehavior.Cascade);
657
+
658
+                    b.HasOne("UnivateProperties_API.Model.Property.PropertyType", "PropertyType")
659
+                        .WithMany()
660
+                        .HasForeignKey("PropertyTypeId")
661
+                        .OnDelete(DeleteBehavior.Cascade);
662
+
663
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
664
+                        .WithMany()
665
+                        .HasForeignKey("ProvinceId")
666
+                        .OnDelete(DeleteBehavior.Cascade);
667
+
668
+                    b.HasOne("UnivateProperties_API.Model.Region.Suburb", "Suburb")
669
+                        .WithMany()
670
+                        .HasForeignKey("SuburbId")
671
+                        .OnDelete(DeleteBehavior.Cascade);
672
+                });
673
+
674
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
675
+                {
676
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
677
+                        .WithMany("PropertyImages")
678
+                        .HasForeignKey("PropertyId")
679
+                        .OnDelete(DeleteBehavior.Cascade);
680
+                });
681
+
682
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
683
+                {
684
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
685
+                        .WithMany("PropertyUserFields")
686
+                        .HasForeignKey("PropertyId")
687
+                        .OnDelete(DeleteBehavior.Cascade);
688
+
689
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedField", "UserDefinedField")
690
+                        .WithMany()
691
+                        .HasForeignKey("UserDefinedFieldId")
692
+                        .OnDelete(DeleteBehavior.Cascade);
693
+                });
694
+
695
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
696
+                {
697
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedGroup", "Group")
698
+                        .WithMany("Fields")
699
+                        .HasForeignKey("GroupId")
700
+                        .OnDelete(DeleteBehavior.Cascade);
701
+                });
702
+
703
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
704
+                {
705
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
706
+                        .WithMany()
707
+                        .HasForeignKey("ProvinceId")
708
+                        .OnDelete(DeleteBehavior.Cascade);
709
+                });
710
+
711
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
712
+                {
713
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
714
+                        .WithMany()
715
+                        .HasForeignKey("CityId")
716
+                        .OnDelete(DeleteBehavior.Cascade);
717
+                });
718
+
719
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
720
+                {
721
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
722
+                        .WithMany()
723
+                        .HasForeignKey("AgencyId");
724
+
725
+                    b.HasOne("UnivateProperties_API.Model.Users.Agent", "Agent")
726
+                        .WithMany()
727
+                        .HasForeignKey("AgentId");
728
+
729
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "Owner")
730
+                        .WithMany()
731
+                        .HasForeignKey("OwnerId")
732
+                        .OnDelete(DeleteBehavior.Cascade);
733
+
734
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Region")
735
+                        .WithMany()
736
+                        .HasForeignKey("RegionId")
737
+                        .OnDelete(DeleteBehavior.Cascade);
738
+
739
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
740
+                        .WithMany()
741
+                        .HasForeignKey("StatusId")
742
+                        .OnDelete(DeleteBehavior.Cascade);
743
+                });
744
+
745
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
746
+                {
747
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.UnitConfiguration", "UnitConfiguration")
748
+                        .WithMany("Types")
749
+                        .HasForeignKey("UnitConfigurationId")
750
+                        .OnDelete(DeleteBehavior.Cascade);
751
+                });
752
+
753
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
754
+                {
755
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
756
+                        .WithMany("Agents")
757
+                        .HasForeignKey("AgencyId");
758
+
759
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
760
+                        .WithMany()
761
+                        .HasForeignKey("UserId")
762
+                        .OnDelete(DeleteBehavior.Cascade);
763
+                });
764
+
765
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
766
+                {
767
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
768
+                        .WithMany()
769
+                        .HasForeignKey("UserId")
770
+                        .OnDelete(DeleteBehavior.Cascade);
771
+                });
772
+#pragma warning restore 612, 618
773
+        }
774
+    }
775
+}

+ 745
- 0
UnivateProperties_API/Migrations/20190903062247_initial.cs View File

@@ -0,0 +1,745 @@
1
+using System;
2
+using Microsoft.EntityFrameworkCore.Migrations;
3
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
4
+
5
+namespace UnivateProperties_API.Migrations
6
+{
7
+    public partial class initial : Migration
8
+    {
9
+        protected override void Up(MigrationBuilder migrationBuilder)
10
+        {
11
+            migrationBuilder.CreateTable(
12
+                name: "Agencies",
13
+                columns: table => new
14
+                {
15
+                    Id = table.Column<int>(nullable: false)
16
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
17
+                    Created = table.Column<DateTime>(nullable: false),
18
+                    Modified = table.Column<DateTime>(nullable: false),
19
+                    ModifiedBy = table.Column<string>(nullable: true),
20
+                    AgencyName = table.Column<string>(nullable: true),
21
+                    EAABEFFCNumber = table.Column<string>(nullable: true),
22
+                    CompanyRegNumber = table.Column<string>(nullable: true)
23
+                },
24
+                constraints: table =>
25
+                {
26
+                    table.PrimaryKey("PK_Agencies", x => x.Id);
27
+                });
28
+
29
+            migrationBuilder.CreateTable(
30
+                name: "Hosts",
31
+                columns: table => new
32
+                {
33
+                    Id = table.Column<int>(nullable: false)
34
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
35
+                    Created = table.Column<DateTime>(nullable: false),
36
+                    Modified = table.Column<DateTime>(nullable: false),
37
+                    ModifiedBy = table.Column<string>(nullable: true),
38
+                    Host = table.Column<string>(nullable: true),
39
+                    NeedsAuthorize = table.Column<bool>(nullable: false),
40
+                    User = table.Column<string>(nullable: true),
41
+                    Password = table.Column<string>(nullable: true),
42
+                    UseSSL = table.Column<bool>(nullable: false)
43
+                },
44
+                constraints: table =>
45
+                {
46
+                    table.PrimaryKey("PK_Hosts", x => x.Id);
47
+                });
48
+
49
+            migrationBuilder.CreateTable(
50
+                name: "PropertyTypes",
51
+                columns: table => new
52
+                {
53
+                    Id = table.Column<int>(nullable: false)
54
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
55
+                    Created = table.Column<DateTime>(nullable: false),
56
+                    Modified = table.Column<DateTime>(nullable: false),
57
+                    ModifiedBy = table.Column<string>(nullable: true),
58
+                    Description = table.Column<string>(nullable: true),
59
+                    UsageType = table.Column<int>(nullable: false)
60
+                },
61
+                constraints: table =>
62
+                {
63
+                    table.PrimaryKey("PK_PropertyTypes", x => x.Id);
64
+                });
65
+
66
+            migrationBuilder.CreateTable(
67
+                name: "Provinces",
68
+                columns: table => new
69
+                {
70
+                    Id = table.Column<int>(nullable: false)
71
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
72
+                    Created = table.Column<DateTime>(nullable: false),
73
+                    Modified = table.Column<DateTime>(nullable: false),
74
+                    ModifiedBy = table.Column<string>(nullable: true),
75
+                    Description = table.Column<string>(nullable: true),
76
+                    Code = table.Column<string>(nullable: true)
77
+                },
78
+                constraints: table =>
79
+                {
80
+                    table.PrimaryKey("PK_Provinces", x => x.Id);
81
+                });
82
+
83
+            migrationBuilder.CreateTable(
84
+                name: "Seasons",
85
+                columns: table => new
86
+                {
87
+                    Id = table.Column<int>(nullable: false)
88
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
89
+                    Created = table.Column<DateTime>(nullable: false),
90
+                    Modified = table.Column<DateTime>(nullable: false),
91
+                    ModifiedBy = table.Column<string>(nullable: true),
92
+                    Name = table.Column<string>(nullable: true)
93
+                },
94
+                constraints: table =>
95
+                {
96
+                    table.PrimaryKey("PK_Seasons", x => x.Id);
97
+                });
98
+
99
+            migrationBuilder.CreateTable(
100
+                name: "Status",
101
+                columns: table => new
102
+                {
103
+                    Id = table.Column<int>(nullable: false)
104
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
105
+                    Created = table.Column<DateTime>(nullable: false),
106
+                    Modified = table.Column<DateTime>(nullable: false),
107
+                    ModifiedBy = table.Column<string>(nullable: true),
108
+                    Code = table.Column<string>(nullable: true),
109
+                    Description = table.Column<string>(nullable: true),
110
+                    StatusType = table.Column<int>(nullable: false)
111
+                },
112
+                constraints: table =>
113
+                {
114
+                    table.PrimaryKey("PK_Status", x => x.Id);
115
+                });
116
+
117
+            migrationBuilder.CreateTable(
118
+                name: "UnitConfigurations",
119
+                columns: table => new
120
+                {
121
+                    Id = table.Column<int>(nullable: false)
122
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
123
+                    Created = table.Column<DateTime>(nullable: false),
124
+                    Modified = table.Column<DateTime>(nullable: false),
125
+                    ModifiedBy = table.Column<string>(nullable: true),
126
+                    Code = table.Column<string>(nullable: true),
127
+                    Bedrooms = table.Column<int>(nullable: false),
128
+                    Adults = table.Column<int>(nullable: false),
129
+                    Children = table.Column<int>(nullable: false)
130
+                },
131
+                constraints: table =>
132
+                {
133
+                    table.PrimaryKey("PK_UnitConfigurations", x => x.Id);
134
+                });
135
+
136
+            migrationBuilder.CreateTable(
137
+                name: "UserDefinedGroups",
138
+                columns: table => new
139
+                {
140
+                    Id = table.Column<int>(nullable: false)
141
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
142
+                    Created = table.Column<DateTime>(nullable: false),
143
+                    Modified = table.Column<DateTime>(nullable: false),
144
+                    ModifiedBy = table.Column<string>(nullable: true),
145
+                    Description = table.Column<string>(nullable: true),
146
+                    UsageType = table.Column<int>(nullable: false),
147
+                    Rank = table.Column<int>(nullable: false)
148
+                },
149
+                constraints: table =>
150
+                {
151
+                    table.PrimaryKey("PK_UserDefinedGroups", x => x.Id);
152
+                });
153
+
154
+            migrationBuilder.CreateTable(
155
+                name: "Users",
156
+                columns: table => new
157
+                {
158
+                    Id = table.Column<int>(nullable: false)
159
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
160
+                    Created = table.Column<DateTime>(nullable: false),
161
+                    Modified = table.Column<DateTime>(nullable: false),
162
+                    ModifiedBy = table.Column<string>(nullable: true),
163
+                    Name = table.Column<string>(nullable: true),
164
+                    Surname = table.Column<string>(nullable: true),
165
+                    Username = table.Column<string>(nullable: true),
166
+                    Role = table.Column<string>(nullable: true),
167
+                    PasswordHash = table.Column<byte[]>(nullable: true),
168
+                    PasswordSalt = table.Column<byte[]>(nullable: true),
169
+                    Verified = table.Column<bool>(nullable: false),
170
+                    Token = table.Column<string>(nullable: true)
171
+                },
172
+                constraints: table =>
173
+                {
174
+                    table.PrimaryKey("PK_Users", x => x.Id);
175
+                });
176
+
177
+            migrationBuilder.CreateTable(
178
+                name: "Accounts",
179
+                columns: table => new
180
+                {
181
+                    Id = table.Column<int>(nullable: false)
182
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
183
+                    Created = table.Column<DateTime>(nullable: false),
184
+                    Modified = table.Column<DateTime>(nullable: false),
185
+                    ModifiedBy = table.Column<string>(nullable: true),
186
+                    Address = table.Column<string>(nullable: true),
187
+                    DisplayName = table.Column<string>(nullable: true),
188
+                    SMTPHostId = table.Column<int>(nullable: false)
189
+                },
190
+                constraints: table =>
191
+                {
192
+                    table.PrimaryKey("PK_Accounts", x => x.Id);
193
+                    table.ForeignKey(
194
+                        name: "FK_Accounts_Hosts_SMTPHostId",
195
+                        column: x => x.SMTPHostId,
196
+                        principalTable: "Hosts",
197
+                        principalColumn: "Id",
198
+                        onDelete: ReferentialAction.Cascade);
199
+                });
200
+
201
+            migrationBuilder.CreateTable(
202
+                name: "Cities",
203
+                columns: table => new
204
+                {
205
+                    Id = table.Column<int>(nullable: false)
206
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
207
+                    Created = table.Column<DateTime>(nullable: false),
208
+                    Modified = table.Column<DateTime>(nullable: false),
209
+                    ModifiedBy = table.Column<string>(nullable: true),
210
+                    ProvinceId = table.Column<int>(nullable: false),
211
+                    Description = table.Column<string>(nullable: true),
212
+                    Code = table.Column<string>(nullable: true)
213
+                },
214
+                constraints: table =>
215
+                {
216
+                    table.PrimaryKey("PK_Cities", x => x.Id);
217
+                    table.ForeignKey(
218
+                        name: "FK_Cities_Provinces_ProvinceId",
219
+                        column: x => x.ProvinceId,
220
+                        principalTable: "Provinces",
221
+                        principalColumn: "Id",
222
+                        onDelete: ReferentialAction.Cascade);
223
+                });
224
+
225
+            migrationBuilder.CreateTable(
226
+                name: "UnitConfigurationTypes",
227
+                columns: table => new
228
+                {
229
+                    Id = table.Column<int>(nullable: false)
230
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
231
+                    Created = table.Column<DateTime>(nullable: false),
232
+                    Modified = table.Column<DateTime>(nullable: false),
233
+                    ModifiedBy = table.Column<string>(nullable: true),
234
+                    Description = table.Column<string>(nullable: true),
235
+                    UnitConfigurationId = table.Column<int>(nullable: false)
236
+                },
237
+                constraints: table =>
238
+                {
239
+                    table.PrimaryKey("PK_UnitConfigurationTypes", x => x.Id);
240
+                    table.ForeignKey(
241
+                        name: "FK_UnitConfigurationTypes_UnitConfigurations_UnitConfiguration~",
242
+                        column: x => x.UnitConfigurationId,
243
+                        principalTable: "UnitConfigurations",
244
+                        principalColumn: "Id",
245
+                        onDelete: ReferentialAction.Cascade);
246
+                });
247
+
248
+            migrationBuilder.CreateTable(
249
+                name: "UserDefinedFields",
250
+                columns: table => new
251
+                {
252
+                    Id = table.Column<int>(nullable: false)
253
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
254
+                    Created = table.Column<DateTime>(nullable: false),
255
+                    Modified = table.Column<DateTime>(nullable: false),
256
+                    ModifiedBy = table.Column<string>(nullable: true),
257
+                    GroupId = table.Column<int>(nullable: false),
258
+                    FieldName = table.Column<string>(nullable: true),
259
+                    FieldType = table.Column<string>(nullable: true),
260
+                    Rank = table.Column<int>(nullable: false)
261
+                },
262
+                constraints: table =>
263
+                {
264
+                    table.PrimaryKey("PK_UserDefinedFields", x => x.Id);
265
+                    table.ForeignKey(
266
+                        name: "FK_UserDefinedFields_UserDefinedGroups_GroupId",
267
+                        column: x => x.GroupId,
268
+                        principalTable: "UserDefinedGroups",
269
+                        principalColumn: "Id",
270
+                        onDelete: ReferentialAction.Cascade);
271
+                });
272
+
273
+            migrationBuilder.CreateTable(
274
+                name: "Agents",
275
+                columns: table => new
276
+                {
277
+                    Id = table.Column<int>(nullable: false)
278
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
279
+                    Created = table.Column<DateTime>(nullable: false),
280
+                    Modified = table.Column<DateTime>(nullable: false),
281
+                    ModifiedBy = table.Column<string>(nullable: true),
282
+                    UserId = table.Column<int>(nullable: false),
283
+                    Name = table.Column<string>(nullable: true),
284
+                    Surname = table.Column<string>(nullable: true),
285
+                    Email = table.Column<string>(nullable: true),
286
+                    Telephone = table.Column<string>(nullable: true),
287
+                    CellNumber = table.Column<string>(nullable: true),
288
+                    AgencyId = table.Column<int>(nullable: true)
289
+                },
290
+                constraints: table =>
291
+                {
292
+                    table.PrimaryKey("PK_Agents", x => x.Id);
293
+                    table.ForeignKey(
294
+                        name: "FK_Agents_Agencies_AgencyId",
295
+                        column: x => x.AgencyId,
296
+                        principalTable: "Agencies",
297
+                        principalColumn: "Id",
298
+                        onDelete: ReferentialAction.Restrict);
299
+                    table.ForeignKey(
300
+                        name: "FK_Agents_Users_UserId",
301
+                        column: x => x.UserId,
302
+                        principalTable: "Users",
303
+                        principalColumn: "Id",
304
+                        onDelete: ReferentialAction.Cascade);
305
+                });
306
+
307
+            migrationBuilder.CreateTable(
308
+                name: "Individuals",
309
+                columns: table => new
310
+                {
311
+                    Id = table.Column<int>(nullable: false)
312
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
313
+                    Created = table.Column<DateTime>(nullable: false),
314
+                    Modified = table.Column<DateTime>(nullable: false),
315
+                    ModifiedBy = table.Column<string>(nullable: true),
316
+                    UserId = table.Column<int>(nullable: false),
317
+                    Name = table.Column<string>(nullable: true),
318
+                    Surname = table.Column<string>(nullable: true),
319
+                    Email = table.Column<string>(nullable: true),
320
+                    Telephone = table.Column<string>(nullable: true),
321
+                    CellNumber = table.Column<string>(nullable: true)
322
+                },
323
+                constraints: table =>
324
+                {
325
+                    table.PrimaryKey("PK_Individuals", x => x.Id);
326
+                    table.ForeignKey(
327
+                        name: "FK_Individuals_Users_UserId",
328
+                        column: x => x.UserId,
329
+                        principalTable: "Users",
330
+                        principalColumn: "Id",
331
+                        onDelete: ReferentialAction.Cascade);
332
+                });
333
+
334
+            migrationBuilder.CreateTable(
335
+                name: "Emails",
336
+                columns: table => new
337
+                {
338
+                    Id = table.Column<int>(nullable: false)
339
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
340
+                    Created = table.Column<DateTime>(nullable: false),
341
+                    Modified = table.Column<DateTime>(nullable: false),
342
+                    ModifiedBy = table.Column<string>(nullable: true),
343
+                    SenderId = table.Column<int>(nullable: false),
344
+                    Comment = table.Column<string>(nullable: true),
345
+                    Subject = table.Column<string>(nullable: true),
346
+                    IsBodyHtml = table.Column<bool>(nullable: false),
347
+                    CC = table.Column<string>(nullable: true),
348
+                    BCC = table.Column<string>(nullable: true),
349
+                    Body = table.Column<string>(nullable: true),
350
+                    To = table.Column<string>(nullable: true),
351
+                    ToDisplay = table.Column<string>(nullable: true)
352
+                },
353
+                constraints: table =>
354
+                {
355
+                    table.PrimaryKey("PK_Emails", x => x.Id);
356
+                    table.ForeignKey(
357
+                        name: "FK_Emails_Accounts_SenderId",
358
+                        column: x => x.SenderId,
359
+                        principalTable: "Accounts",
360
+                        principalColumn: "Id",
361
+                        onDelete: ReferentialAction.Cascade);
362
+                });
363
+
364
+            migrationBuilder.CreateTable(
365
+                name: "Suburbs",
366
+                columns: table => new
367
+                {
368
+                    Id = table.Column<int>(nullable: false)
369
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
370
+                    Created = table.Column<DateTime>(nullable: false),
371
+                    Modified = table.Column<DateTime>(nullable: false),
372
+                    ModifiedBy = table.Column<string>(nullable: true),
373
+                    CityId = table.Column<int>(nullable: false),
374
+                    Description = table.Column<string>(nullable: true),
375
+                    PostalCode = table.Column<string>(nullable: true)
376
+                },
377
+                constraints: table =>
378
+                {
379
+                    table.PrimaryKey("PK_Suburbs", x => x.Id);
380
+                    table.ForeignKey(
381
+                        name: "FK_Suburbs_Cities_CityId",
382
+                        column: x => x.CityId,
383
+                        principalTable: "Cities",
384
+                        principalColumn: "Id",
385
+                        onDelete: ReferentialAction.Cascade);
386
+                });
387
+
388
+            migrationBuilder.CreateTable(
389
+                name: "Weeks",
390
+                columns: table => new
391
+                {
392
+                    Id = table.Column<int>(nullable: false)
393
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
394
+                    Created = table.Column<DateTime>(nullable: false),
395
+                    Modified = table.Column<DateTime>(nullable: false),
396
+                    ModifiedBy = table.Column<string>(nullable: true),
397
+                    ReferedByAgent = table.Column<bool>(nullable: false),
398
+                    AgentId = table.Column<int>(nullable: true),
399
+                    AgencyId = table.Column<int>(nullable: true),
400
+                    OwnerId = table.Column<int>(nullable: false),
401
+                    OtherResort = table.Column<bool>(nullable: false),
402
+                    ResortCode = table.Column<string>(nullable: true),
403
+                    ResortName = table.Column<string>(nullable: true),
404
+                    RegionId = table.Column<int>(nullable: false),
405
+                    Season = table.Column<string>(nullable: true),
406
+                    Module = table.Column<string>(nullable: true),
407
+                    Bedrooms = table.Column<int>(nullable: false),
408
+                    MaxSleep = table.Column<int>(nullable: false),
409
+                    WeekNumber = table.Column<string>(nullable: true),
410
+                    LevyAmount = table.Column<double>(nullable: false),
411
+                    CurrentYearBanked = table.Column<bool>(nullable: false),
412
+                    BankedWith = table.Column<string>(nullable: true),
413
+                    LeviesPaidInFull = table.Column<bool>(nullable: false),
414
+                    WeekPlacedForRental = table.Column<bool>(nullable: false),
415
+                    OriginalPurchasePrice = table.Column<double>(nullable: false),
416
+                    OriginalPurchaseDate = table.Column<DateTime>(nullable: false),
417
+                    ArrivalDate = table.Column<DateTime>(nullable: false),
418
+                    DepartureDate = table.Column<DateTime>(nullable: false),
419
+                    StatusId = table.Column<int>(nullable: false)
420
+                },
421
+                constraints: table =>
422
+                {
423
+                    table.PrimaryKey("PK_Weeks", x => x.Id);
424
+                    table.ForeignKey(
425
+                        name: "FK_Weeks_Agencies_AgencyId",
426
+                        column: x => x.AgencyId,
427
+                        principalTable: "Agencies",
428
+                        principalColumn: "Id",
429
+                        onDelete: ReferentialAction.Restrict);
430
+                    table.ForeignKey(
431
+                        name: "FK_Weeks_Agents_AgentId",
432
+                        column: x => x.AgentId,
433
+                        principalTable: "Agents",
434
+                        principalColumn: "Id",
435
+                        onDelete: ReferentialAction.Restrict);
436
+                    table.ForeignKey(
437
+                        name: "FK_Weeks_Users_OwnerId",
438
+                        column: x => x.OwnerId,
439
+                        principalTable: "Users",
440
+                        principalColumn: "Id",
441
+                        onDelete: ReferentialAction.Cascade);
442
+                    table.ForeignKey(
443
+                        name: "FK_Weeks_Provinces_RegionId",
444
+                        column: x => x.RegionId,
445
+                        principalTable: "Provinces",
446
+                        principalColumn: "Id",
447
+                        onDelete: ReferentialAction.Cascade);
448
+                    table.ForeignKey(
449
+                        name: "FK_Weeks_Status_StatusId",
450
+                        column: x => x.StatusId,
451
+                        principalTable: "Status",
452
+                        principalColumn: "Id",
453
+                        onDelete: ReferentialAction.Cascade);
454
+                });
455
+
456
+            migrationBuilder.CreateTable(
457
+                name: "Properties",
458
+                columns: table => new
459
+                {
460
+                    Id = table.Column<int>(nullable: false)
461
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
462
+                    Created = table.Column<DateTime>(nullable: false),
463
+                    Modified = table.Column<DateTime>(nullable: false),
464
+                    ModifiedBy = table.Column<string>(nullable: true),
465
+                    CreatedBy = table.Column<string>(nullable: true),
466
+                    PropertyTypeId = table.Column<int>(nullable: false),
467
+                    PropertyName = table.Column<string>(nullable: true),
468
+                    Unit = table.Column<string>(nullable: true),
469
+                    OperationalCosts = table.Column<decimal>(nullable: false),
470
+                    Price = table.Column<decimal>(nullable: false),
471
+                    PricePer = table.Column<string>(nullable: true),
472
+                    IsSale = table.Column<bool>(nullable: false),
473
+                    Description = table.Column<string>(nullable: true),
474
+                    ShortDescription = table.Column<string>(nullable: true),
475
+                    AddressLine1 = table.Column<string>(nullable: true),
476
+                    AddressLine2 = table.Column<string>(nullable: true),
477
+                    AddressLine3 = table.Column<string>(nullable: true),
478
+                    SuburbId = table.Column<int>(nullable: false),
479
+                    CityId = table.Column<int>(nullable: false),
480
+                    ProvinceId = table.Column<int>(nullable: false),
481
+                    Published = table.Column<bool>(nullable: false)
482
+                },
483
+                constraints: table =>
484
+                {
485
+                    table.PrimaryKey("PK_Properties", x => x.Id);
486
+                    table.ForeignKey(
487
+                        name: "FK_Properties_Cities_CityId",
488
+                        column: x => x.CityId,
489
+                        principalTable: "Cities",
490
+                        principalColumn: "Id",
491
+                        onDelete: ReferentialAction.Cascade);
492
+                    table.ForeignKey(
493
+                        name: "FK_Properties_PropertyTypes_PropertyTypeId",
494
+                        column: x => x.PropertyTypeId,
495
+                        principalTable: "PropertyTypes",
496
+                        principalColumn: "Id",
497
+                        onDelete: ReferentialAction.Cascade);
498
+                    table.ForeignKey(
499
+                        name: "FK_Properties_Provinces_ProvinceId",
500
+                        column: x => x.ProvinceId,
501
+                        principalTable: "Provinces",
502
+                        principalColumn: "Id",
503
+                        onDelete: ReferentialAction.Cascade);
504
+                    table.ForeignKey(
505
+                        name: "FK_Properties_Suburbs_SuburbId",
506
+                        column: x => x.SuburbId,
507
+                        principalTable: "Suburbs",
508
+                        principalColumn: "Id",
509
+                        onDelete: ReferentialAction.Cascade);
510
+                });
511
+
512
+            migrationBuilder.CreateTable(
513
+                name: "PropertyImages",
514
+                columns: table => new
515
+                {
516
+                    Id = table.Column<int>(nullable: false)
517
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
518
+                    Created = table.Column<DateTime>(nullable: false),
519
+                    Modified = table.Column<DateTime>(nullable: false),
520
+                    ModifiedBy = table.Column<string>(nullable: true),
521
+                    PropertyId = table.Column<int>(nullable: false),
522
+                    Image = table.Column<string>(nullable: true),
523
+                    IsDefault = table.Column<bool>(nullable: false)
524
+                },
525
+                constraints: table =>
526
+                {
527
+                    table.PrimaryKey("PK_PropertyImages", x => x.Id);
528
+                    table.ForeignKey(
529
+                        name: "FK_PropertyImages_Properties_PropertyId",
530
+                        column: x => x.PropertyId,
531
+                        principalTable: "Properties",
532
+                        principalColumn: "Id",
533
+                        onDelete: ReferentialAction.Cascade);
534
+                });
535
+
536
+            migrationBuilder.CreateTable(
537
+                name: "PropertyUserFields",
538
+                columns: table => new
539
+                {
540
+                    Id = table.Column<int>(nullable: false)
541
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
542
+                    Created = table.Column<DateTime>(nullable: false),
543
+                    Modified = table.Column<DateTime>(nullable: false),
544
+                    ModifiedBy = table.Column<string>(nullable: true),
545
+                    PropertyId = table.Column<int>(nullable: false),
546
+                    UserDefinedFieldId = table.Column<int>(nullable: false),
547
+                    Value = table.Column<string>(nullable: true),
548
+                    Description = table.Column<string>(nullable: true)
549
+                },
550
+                constraints: table =>
551
+                {
552
+                    table.PrimaryKey("PK_PropertyUserFields", x => x.Id);
553
+                    table.ForeignKey(
554
+                        name: "FK_PropertyUserFields_Properties_PropertyId",
555
+                        column: x => x.PropertyId,
556
+                        principalTable: "Properties",
557
+                        principalColumn: "Id",
558
+                        onDelete: ReferentialAction.Cascade);
559
+                    table.ForeignKey(
560
+                        name: "FK_PropertyUserFields_UserDefinedFields_UserDefinedFieldId",
561
+                        column: x => x.UserDefinedFieldId,
562
+                        principalTable: "UserDefinedFields",
563
+                        principalColumn: "Id",
564
+                        onDelete: ReferentialAction.Cascade);
565
+                });
566
+
567
+            migrationBuilder.CreateIndex(
568
+                name: "IX_Accounts_SMTPHostId",
569
+                table: "Accounts",
570
+                column: "SMTPHostId");
571
+
572
+            migrationBuilder.CreateIndex(
573
+                name: "IX_Agents_AgencyId",
574
+                table: "Agents",
575
+                column: "AgencyId");
576
+
577
+            migrationBuilder.CreateIndex(
578
+                name: "IX_Agents_UserId",
579
+                table: "Agents",
580
+                column: "UserId");
581
+
582
+            migrationBuilder.CreateIndex(
583
+                name: "IX_Cities_ProvinceId",
584
+                table: "Cities",
585
+                column: "ProvinceId");
586
+
587
+            migrationBuilder.CreateIndex(
588
+                name: "IX_Emails_SenderId",
589
+                table: "Emails",
590
+                column: "SenderId");
591
+
592
+            migrationBuilder.CreateIndex(
593
+                name: "IX_Individuals_UserId",
594
+                table: "Individuals",
595
+                column: "UserId");
596
+
597
+            migrationBuilder.CreateIndex(
598
+                name: "IX_Properties_CityId",
599
+                table: "Properties",
600
+                column: "CityId");
601
+
602
+            migrationBuilder.CreateIndex(
603
+                name: "IX_Properties_PropertyTypeId",
604
+                table: "Properties",
605
+                column: "PropertyTypeId");
606
+
607
+            migrationBuilder.CreateIndex(
608
+                name: "IX_Properties_ProvinceId",
609
+                table: "Properties",
610
+                column: "ProvinceId");
611
+
612
+            migrationBuilder.CreateIndex(
613
+                name: "IX_Properties_SuburbId",
614
+                table: "Properties",
615
+                column: "SuburbId");
616
+
617
+            migrationBuilder.CreateIndex(
618
+                name: "IX_PropertyImages_PropertyId",
619
+                table: "PropertyImages",
620
+                column: "PropertyId");
621
+
622
+            migrationBuilder.CreateIndex(
623
+                name: "IX_PropertyUserFields_PropertyId",
624
+                table: "PropertyUserFields",
625
+                column: "PropertyId");
626
+
627
+            migrationBuilder.CreateIndex(
628
+                name: "IX_PropertyUserFields_UserDefinedFieldId",
629
+                table: "PropertyUserFields",
630
+                column: "UserDefinedFieldId");
631
+
632
+            migrationBuilder.CreateIndex(
633
+                name: "IX_Suburbs_CityId",
634
+                table: "Suburbs",
635
+                column: "CityId");
636
+
637
+            migrationBuilder.CreateIndex(
638
+                name: "IX_UnitConfigurations_Code",
639
+                table: "UnitConfigurations",
640
+                column: "Code",
641
+                unique: true);
642
+
643
+            migrationBuilder.CreateIndex(
644
+                name: "IX_UnitConfigurationTypes_UnitConfigurationId",
645
+                table: "UnitConfigurationTypes",
646
+                column: "UnitConfigurationId");
647
+
648
+            migrationBuilder.CreateIndex(
649
+                name: "IX_UserDefinedFields_GroupId",
650
+                table: "UserDefinedFields",
651
+                column: "GroupId");
652
+
653
+            migrationBuilder.CreateIndex(
654
+                name: "IX_Weeks_AgencyId",
655
+                table: "Weeks",
656
+                column: "AgencyId");
657
+
658
+            migrationBuilder.CreateIndex(
659
+                name: "IX_Weeks_AgentId",
660
+                table: "Weeks",
661
+                column: "AgentId");
662
+
663
+            migrationBuilder.CreateIndex(
664
+                name: "IX_Weeks_OwnerId",
665
+                table: "Weeks",
666
+                column: "OwnerId");
667
+
668
+            migrationBuilder.CreateIndex(
669
+                name: "IX_Weeks_RegionId",
670
+                table: "Weeks",
671
+                column: "RegionId");
672
+
673
+            migrationBuilder.CreateIndex(
674
+                name: "IX_Weeks_StatusId",
675
+                table: "Weeks",
676
+                column: "StatusId");
677
+        }
678
+
679
+        protected override void Down(MigrationBuilder migrationBuilder)
680
+        {
681
+            migrationBuilder.DropTable(
682
+                name: "Emails");
683
+
684
+            migrationBuilder.DropTable(
685
+                name: "Individuals");
686
+
687
+            migrationBuilder.DropTable(
688
+                name: "PropertyImages");
689
+
690
+            migrationBuilder.DropTable(
691
+                name: "PropertyUserFields");
692
+
693
+            migrationBuilder.DropTable(
694
+                name: "Seasons");
695
+
696
+            migrationBuilder.DropTable(
697
+                name: "UnitConfigurationTypes");
698
+
699
+            migrationBuilder.DropTable(
700
+                name: "Weeks");
701
+
702
+            migrationBuilder.DropTable(
703
+                name: "Accounts");
704
+
705
+            migrationBuilder.DropTable(
706
+                name: "Properties");
707
+
708
+            migrationBuilder.DropTable(
709
+                name: "UserDefinedFields");
710
+
711
+            migrationBuilder.DropTable(
712
+                name: "UnitConfigurations");
713
+
714
+            migrationBuilder.DropTable(
715
+                name: "Agents");
716
+
717
+            migrationBuilder.DropTable(
718
+                name: "Status");
719
+
720
+            migrationBuilder.DropTable(
721
+                name: "Hosts");
722
+
723
+            migrationBuilder.DropTable(
724
+                name: "PropertyTypes");
725
+
726
+            migrationBuilder.DropTable(
727
+                name: "Suburbs");
728
+
729
+            migrationBuilder.DropTable(
730
+                name: "UserDefinedGroups");
731
+
732
+            migrationBuilder.DropTable(
733
+                name: "Agencies");
734
+
735
+            migrationBuilder.DropTable(
736
+                name: "Users");
737
+
738
+            migrationBuilder.DropTable(
739
+                name: "Cities");
740
+
741
+            migrationBuilder.DropTable(
742
+                name: "Provinces");
743
+        }
744
+    }
745
+}

+ 773
- 0
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs View File

@@ -0,0 +1,773 @@
1
+// <auto-generated />
2
+using System;
3
+using Microsoft.EntityFrameworkCore;
4
+using Microsoft.EntityFrameworkCore.Infrastructure;
5
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
7
+using UnivateProperties_API.Context;
8
+
9
+namespace UnivateProperties_API.Migrations
10
+{
11
+    [DbContext(typeof(DataContext))]
12
+    partial class DataContextModelSnapshot : ModelSnapshot
13
+    {
14
+        protected override void BuildModel(ModelBuilder modelBuilder)
15
+        {
16
+#pragma warning disable 612, 618
17
+            modelBuilder
18
+                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
19
+                .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
20
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
21
+
22
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
23
+                {
24
+                    b.Property<int>("Id")
25
+                        .ValueGeneratedOnAdd();
26
+
27
+                    b.Property<string>("BCC");
28
+
29
+                    b.Property<string>("Body");
30
+
31
+                    b.Property<string>("CC");
32
+
33
+                    b.Property<string>("Comment");
34
+
35
+                    b.Property<DateTime>("Created");
36
+
37
+                    b.Property<bool>("IsBodyHtml");
38
+
39
+                    b.Property<DateTime>("Modified");
40
+
41
+                    b.Property<string>("ModifiedBy");
42
+
43
+                    b.Property<int>("SenderId");
44
+
45
+                    b.Property<string>("Subject");
46
+
47
+                    b.Property<string>("To");
48
+
49
+                    b.Property<string>("ToDisplay");
50
+
51
+                    b.HasKey("Id");
52
+
53
+                    b.HasIndex("SenderId");
54
+
55
+                    b.ToTable("Emails");
56
+                });
57
+
58
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
59
+                {
60
+                    b.Property<int>("Id")
61
+                        .ValueGeneratedOnAdd();
62
+
63
+                    b.Property<string>("Address");
64
+
65
+                    b.Property<DateTime>("Created");
66
+
67
+                    b.Property<string>("DisplayName");
68
+
69
+                    b.Property<DateTime>("Modified");
70
+
71
+                    b.Property<string>("ModifiedBy");
72
+
73
+                    b.Property<int>("SMTPHostId");
74
+
75
+                    b.HasKey("Id");
76
+
77
+                    b.HasIndex("SMTPHostId");
78
+
79
+                    b.ToTable("Accounts");
80
+                });
81
+
82
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPHost", b =>
83
+                {
84
+                    b.Property<int>("Id")
85
+                        .ValueGeneratedOnAdd();
86
+
87
+                    b.Property<DateTime>("Created");
88
+
89
+                    b.Property<string>("Host");
90
+
91
+                    b.Property<DateTime>("Modified");
92
+
93
+                    b.Property<string>("ModifiedBy");
94
+
95
+                    b.Property<bool>("NeedsAuthorize");
96
+
97
+                    b.Property<string>("Password");
98
+
99
+                    b.Property<bool>("UseSSL");
100
+
101
+                    b.Property<string>("User");
102
+
103
+                    b.HasKey("Id");
104
+
105
+                    b.ToTable("Hosts");
106
+                });
107
+
108
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
109
+                {
110
+                    b.Property<int>("Id")
111
+                        .ValueGeneratedOnAdd();
112
+
113
+                    b.Property<string>("AddressLine1");
114
+
115
+                    b.Property<string>("AddressLine2");
116
+
117
+                    b.Property<string>("AddressLine3");
118
+
119
+                    b.Property<int>("CityId");
120
+
121
+                    b.Property<DateTime>("Created");
122
+
123
+                    b.Property<string>("CreatedBy");
124
+
125
+                    b.Property<string>("Description");
126
+
127
+                    b.Property<bool>("IsSale");
128
+
129
+                    b.Property<DateTime>("Modified");
130
+
131
+                    b.Property<string>("ModifiedBy");
132
+
133
+                    b.Property<decimal>("OperationalCosts");
134
+
135
+                    b.Property<decimal>("Price");
136
+
137
+                    b.Property<string>("PricePer");
138
+
139
+                    b.Property<string>("PropertyName");
140
+
141
+                    b.Property<int>("PropertyTypeId");
142
+
143
+                    b.Property<int>("ProvinceId");
144
+
145
+                    b.Property<bool>("Published");
146
+
147
+                    b.Property<string>("ShortDescription");
148
+
149
+                    b.Property<int>("SuburbId");
150
+
151
+                    b.Property<string>("Unit");
152
+
153
+                    b.HasKey("Id");
154
+
155
+                    b.HasIndex("CityId");
156
+
157
+                    b.HasIndex("PropertyTypeId");
158
+
159
+                    b.HasIndex("ProvinceId");
160
+
161
+                    b.HasIndex("SuburbId");
162
+
163
+                    b.ToTable("Properties");
164
+                });
165
+
166
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
167
+                {
168
+                    b.Property<int>("Id")
169
+                        .ValueGeneratedOnAdd();
170
+
171
+                    b.Property<DateTime>("Created");
172
+
173
+                    b.Property<string>("Image");
174
+
175
+                    b.Property<bool>("IsDefault");
176
+
177
+                    b.Property<DateTime>("Modified");
178
+
179
+                    b.Property<string>("ModifiedBy");
180
+
181
+                    b.Property<int>("PropertyId");
182
+
183
+                    b.HasKey("Id");
184
+
185
+                    b.HasIndex("PropertyId");
186
+
187
+                    b.ToTable("PropertyImages");
188
+                });
189
+
190
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyType", b =>
191
+                {
192
+                    b.Property<int>("Id")
193
+                        .ValueGeneratedOnAdd();
194
+
195
+                    b.Property<DateTime>("Created");
196
+
197
+                    b.Property<string>("Description");
198
+
199
+                    b.Property<DateTime>("Modified");
200
+
201
+                    b.Property<string>("ModifiedBy");
202
+
203
+                    b.Property<int>("UsageType");
204
+
205
+                    b.HasKey("Id");
206
+
207
+                    b.ToTable("PropertyTypes");
208
+                });
209
+
210
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
211
+                {
212
+                    b.Property<int>("Id")
213
+                        .ValueGeneratedOnAdd();
214
+
215
+                    b.Property<DateTime>("Created");
216
+
217
+                    b.Property<string>("Description");
218
+
219
+                    b.Property<DateTime>("Modified");
220
+
221
+                    b.Property<string>("ModifiedBy");
222
+
223
+                    b.Property<int>("PropertyId");
224
+
225
+                    b.Property<int>("UserDefinedFieldId");
226
+
227
+                    b.Property<string>("Value");
228
+
229
+                    b.HasKey("Id");
230
+
231
+                    b.HasIndex("PropertyId");
232
+
233
+                    b.HasIndex("UserDefinedFieldId");
234
+
235
+                    b.ToTable("PropertyUserFields");
236
+                });
237
+
238
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
239
+                {
240
+                    b.Property<int>("Id")
241
+                        .ValueGeneratedOnAdd();
242
+
243
+                    b.Property<DateTime>("Created");
244
+
245
+                    b.Property<string>("FieldName");
246
+
247
+                    b.Property<string>("FieldType");
248
+
249
+                    b.Property<int>("GroupId");
250
+
251
+                    b.Property<DateTime>("Modified");
252
+
253
+                    b.Property<string>("ModifiedBy");
254
+
255
+                    b.Property<int>("Rank");
256
+
257
+                    b.HasKey("Id");
258
+
259
+                    b.HasIndex("GroupId");
260
+
261
+                    b.ToTable("UserDefinedFields");
262
+                });
263
+
264
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedGroup", b =>
265
+                {
266
+                    b.Property<int>("Id")
267
+                        .ValueGeneratedOnAdd();
268
+
269
+                    b.Property<DateTime>("Created");
270
+
271
+                    b.Property<string>("Description");
272
+
273
+                    b.Property<DateTime>("Modified");
274
+
275
+                    b.Property<string>("ModifiedBy");
276
+
277
+                    b.Property<int>("Rank");
278
+
279
+                    b.Property<int>("UsageType");
280
+
281
+                    b.HasKey("Id");
282
+
283
+                    b.ToTable("UserDefinedGroups");
284
+                });
285
+
286
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
287
+                {
288
+                    b.Property<int>("Id")
289
+                        .ValueGeneratedOnAdd();
290
+
291
+                    b.Property<string>("Code");
292
+
293
+                    b.Property<DateTime>("Created");
294
+
295
+                    b.Property<string>("Description");
296
+
297
+                    b.Property<DateTime>("Modified");
298
+
299
+                    b.Property<string>("ModifiedBy");
300
+
301
+                    b.Property<int>("ProvinceId");
302
+
303
+                    b.HasKey("Id");
304
+
305
+                    b.HasIndex("ProvinceId");
306
+
307
+                    b.ToTable("Cities");
308
+                });
309
+
310
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Province", b =>
311
+                {
312
+                    b.Property<int>("Id")
313
+                        .ValueGeneratedOnAdd();
314
+
315
+                    b.Property<string>("Code");
316
+
317
+                    b.Property<DateTime>("Created");
318
+
319
+                    b.Property<string>("Description");
320
+
321
+                    b.Property<DateTime>("Modified");
322
+
323
+                    b.Property<string>("ModifiedBy");
324
+
325
+                    b.HasKey("Id");
326
+
327
+                    b.ToTable("Provinces");
328
+                });
329
+
330
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
331
+                {
332
+                    b.Property<int>("Id")
333
+                        .ValueGeneratedOnAdd();
334
+
335
+                    b.Property<int>("CityId");
336
+
337
+                    b.Property<DateTime>("Created");
338
+
339
+                    b.Property<string>("Description");
340
+
341
+                    b.Property<DateTime>("Modified");
342
+
343
+                    b.Property<string>("ModifiedBy");
344
+
345
+                    b.Property<string>("PostalCode");
346
+
347
+                    b.HasKey("Id");
348
+
349
+                    b.HasIndex("CityId");
350
+
351
+                    b.ToTable("Suburbs");
352
+                });
353
+
354
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Season", b =>
355
+                {
356
+                    b.Property<int>("Id")
357
+                        .ValueGeneratedOnAdd();
358
+
359
+                    b.Property<DateTime>("Created");
360
+
361
+                    b.Property<DateTime>("Modified");
362
+
363
+                    b.Property<string>("ModifiedBy");
364
+
365
+                    b.Property<string>("Name");
366
+
367
+                    b.HasKey("Id");
368
+
369
+                    b.ToTable("Seasons");
370
+                });
371
+
372
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Status", b =>
373
+                {
374
+                    b.Property<int>("Id")
375
+                        .ValueGeneratedOnAdd();
376
+
377
+                    b.Property<string>("Code");
378
+
379
+                    b.Property<DateTime>("Created");
380
+
381
+                    b.Property<string>("Description");
382
+
383
+                    b.Property<DateTime>("Modified");
384
+
385
+                    b.Property<string>("ModifiedBy");
386
+
387
+                    b.Property<int>("StatusType");
388
+
389
+                    b.HasKey("Id");
390
+
391
+                    b.ToTable("Status");
392
+                });
393
+
394
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
395
+                {
396
+                    b.Property<int>("Id")
397
+                        .ValueGeneratedOnAdd();
398
+
399
+                    b.Property<int?>("AgencyId");
400
+
401
+                    b.Property<int?>("AgentId");
402
+
403
+                    b.Property<DateTime>("ArrivalDate");
404
+
405
+                    b.Property<string>("BankedWith");
406
+
407
+                    b.Property<int>("Bedrooms");
408
+
409
+                    b.Property<DateTime>("Created");
410
+
411
+                    b.Property<bool>("CurrentYearBanked");
412
+
413
+                    b.Property<DateTime>("DepartureDate");
414
+
415
+                    b.Property<bool>("LeviesPaidInFull");
416
+
417
+                    b.Property<double>("LevyAmount");
418
+
419
+                    b.Property<int>("MaxSleep");
420
+
421
+                    b.Property<DateTime>("Modified");
422
+
423
+                    b.Property<string>("ModifiedBy");
424
+
425
+                    b.Property<string>("Module");
426
+
427
+                    b.Property<DateTime>("OriginalPurchaseDate");
428
+
429
+                    b.Property<double>("OriginalPurchasePrice");
430
+
431
+                    b.Property<bool>("OtherResort");
432
+
433
+                    b.Property<int>("OwnerId");
434
+
435
+                    b.Property<bool>("ReferedByAgent");
436
+
437
+                    b.Property<int>("RegionId");
438
+
439
+                    b.Property<string>("ResortCode");
440
+
441
+                    b.Property<string>("ResortName");
442
+
443
+                    b.Property<string>("Season");
444
+
445
+                    b.Property<int>("StatusId");
446
+
447
+                    b.Property<string>("WeekNumber");
448
+
449
+                    b.Property<bool>("WeekPlacedForRental");
450
+
451
+                    b.HasKey("Id");
452
+
453
+                    b.HasIndex("AgencyId");
454
+
455
+                    b.HasIndex("AgentId");
456
+
457
+                    b.HasIndex("OwnerId");
458
+
459
+                    b.HasIndex("RegionId");
460
+
461
+                    b.HasIndex("StatusId");
462
+
463
+                    b.ToTable("Weeks");
464
+                });
465
+
466
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfiguration", b =>
467
+                {
468
+                    b.Property<int>("Id")
469
+                        .ValueGeneratedOnAdd();
470
+
471
+                    b.Property<int>("Adults");
472
+
473
+                    b.Property<int>("Bedrooms");
474
+
475
+                    b.Property<int>("Children");
476
+
477
+                    b.Property<string>("Code");
478
+
479
+                    b.Property<DateTime>("Created");
480
+
481
+                    b.Property<DateTime>("Modified");
482
+
483
+                    b.Property<string>("ModifiedBy");
484
+
485
+                    b.HasKey("Id");
486
+
487
+                    b.HasIndex("Code")
488
+                        .IsUnique();
489
+
490
+                    b.ToTable("UnitConfigurations");
491
+                });
492
+
493
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
494
+                {
495
+                    b.Property<int>("Id")
496
+                        .ValueGeneratedOnAdd();
497
+
498
+                    b.Property<DateTime>("Created");
499
+
500
+                    b.Property<string>("Description");
501
+
502
+                    b.Property<DateTime>("Modified");
503
+
504
+                    b.Property<string>("ModifiedBy");
505
+
506
+                    b.Property<int>("UnitConfigurationId");
507
+
508
+                    b.HasKey("Id");
509
+
510
+                    b.HasIndex("UnitConfigurationId");
511
+
512
+                    b.ToTable("UnitConfigurationTypes");
513
+                });
514
+
515
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agency", b =>
516
+                {
517
+                    b.Property<int>("Id")
518
+                        .ValueGeneratedOnAdd();
519
+
520
+                    b.Property<string>("AgencyName");
521
+
522
+                    b.Property<string>("CompanyRegNumber");
523
+
524
+                    b.Property<DateTime>("Created");
525
+
526
+                    b.Property<string>("EAABEFFCNumber");
527
+
528
+                    b.Property<DateTime>("Modified");
529
+
530
+                    b.Property<string>("ModifiedBy");
531
+
532
+                    b.HasKey("Id");
533
+
534
+                    b.ToTable("Agencies");
535
+                });
536
+
537
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
538
+                {
539
+                    b.Property<int>("Id")
540
+                        .ValueGeneratedOnAdd();
541
+
542
+                    b.Property<int?>("AgencyId");
543
+
544
+                    b.Property<string>("CellNumber");
545
+
546
+                    b.Property<DateTime>("Created");
547
+
548
+                    b.Property<string>("Email");
549
+
550
+                    b.Property<DateTime>("Modified");
551
+
552
+                    b.Property<string>("ModifiedBy");
553
+
554
+                    b.Property<string>("Name");
555
+
556
+                    b.Property<string>("Surname");
557
+
558
+                    b.Property<string>("Telephone");
559
+
560
+                    b.Property<int>("UserId");
561
+
562
+                    b.HasKey("Id");
563
+
564
+                    b.HasIndex("AgencyId");
565
+
566
+                    b.HasIndex("UserId");
567
+
568
+                    b.ToTable("Agents");
569
+                });
570
+
571
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
572
+                {
573
+                    b.Property<int>("Id")
574
+                        .ValueGeneratedOnAdd();
575
+
576
+                    b.Property<string>("CellNumber");
577
+
578
+                    b.Property<DateTime>("Created");
579
+
580
+                    b.Property<string>("Email");
581
+
582
+                    b.Property<DateTime>("Modified");
583
+
584
+                    b.Property<string>("ModifiedBy");
585
+
586
+                    b.Property<string>("Name");
587
+
588
+                    b.Property<string>("Surname");
589
+
590
+                    b.Property<string>("Telephone");
591
+
592
+                    b.Property<int>("UserId");
593
+
594
+                    b.HasKey("Id");
595
+
596
+                    b.HasIndex("UserId");
597
+
598
+                    b.ToTable("Individuals");
599
+                });
600
+
601
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.User", b =>
602
+                {
603
+                    b.Property<int>("Id")
604
+                        .ValueGeneratedOnAdd();
605
+
606
+                    b.Property<DateTime>("Created");
607
+
608
+                    b.Property<DateTime>("Modified");
609
+
610
+                    b.Property<string>("ModifiedBy");
611
+
612
+                    b.Property<string>("Name");
613
+
614
+                    b.Property<byte[]>("PasswordHash");
615
+
616
+                    b.Property<byte[]>("PasswordSalt");
617
+
618
+                    b.Property<string>("Role");
619
+
620
+                    b.Property<string>("Surname");
621
+
622
+                    b.Property<string>("Token");
623
+
624
+                    b.Property<string>("Username");
625
+
626
+                    b.Property<bool>("Verified");
627
+
628
+                    b.HasKey("Id");
629
+
630
+                    b.ToTable("Users");
631
+                });
632
+
633
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
634
+                {
635
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPAccount", "Sender")
636
+                        .WithMany("Emails")
637
+                        .HasForeignKey("SenderId")
638
+                        .OnDelete(DeleteBehavior.Cascade);
639
+                });
640
+
641
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
642
+                {
643
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPHost", "SMTPHost")
644
+                        .WithMany("SMTPAccounts")
645
+                        .HasForeignKey("SMTPHostId")
646
+                        .OnDelete(DeleteBehavior.Cascade);
647
+                });
648
+
649
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
650
+                {
651
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
652
+                        .WithMany()
653
+                        .HasForeignKey("CityId")
654
+                        .OnDelete(DeleteBehavior.Cascade);
655
+
656
+                    b.HasOne("UnivateProperties_API.Model.Property.PropertyType", "PropertyType")
657
+                        .WithMany()
658
+                        .HasForeignKey("PropertyTypeId")
659
+                        .OnDelete(DeleteBehavior.Cascade);
660
+
661
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
662
+                        .WithMany()
663
+                        .HasForeignKey("ProvinceId")
664
+                        .OnDelete(DeleteBehavior.Cascade);
665
+
666
+                    b.HasOne("UnivateProperties_API.Model.Region.Suburb", "Suburb")
667
+                        .WithMany()
668
+                        .HasForeignKey("SuburbId")
669
+                        .OnDelete(DeleteBehavior.Cascade);
670
+                });
671
+
672
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
673
+                {
674
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
675
+                        .WithMany("PropertyImages")
676
+                        .HasForeignKey("PropertyId")
677
+                        .OnDelete(DeleteBehavior.Cascade);
678
+                });
679
+
680
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
681
+                {
682
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
683
+                        .WithMany("PropertyUserFields")
684
+                        .HasForeignKey("PropertyId")
685
+                        .OnDelete(DeleteBehavior.Cascade);
686
+
687
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedField", "UserDefinedField")
688
+                        .WithMany()
689
+                        .HasForeignKey("UserDefinedFieldId")
690
+                        .OnDelete(DeleteBehavior.Cascade);
691
+                });
692
+
693
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
694
+                {
695
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedGroup", "Group")
696
+                        .WithMany("Fields")
697
+                        .HasForeignKey("GroupId")
698
+                        .OnDelete(DeleteBehavior.Cascade);
699
+                });
700
+
701
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
702
+                {
703
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
704
+                        .WithMany()
705
+                        .HasForeignKey("ProvinceId")
706
+                        .OnDelete(DeleteBehavior.Cascade);
707
+                });
708
+
709
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
710
+                {
711
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
712
+                        .WithMany()
713
+                        .HasForeignKey("CityId")
714
+                        .OnDelete(DeleteBehavior.Cascade);
715
+                });
716
+
717
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
718
+                {
719
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
720
+                        .WithMany()
721
+                        .HasForeignKey("AgencyId");
722
+
723
+                    b.HasOne("UnivateProperties_API.Model.Users.Agent", "Agent")
724
+                        .WithMany()
725
+                        .HasForeignKey("AgentId");
726
+
727
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "Owner")
728
+                        .WithMany()
729
+                        .HasForeignKey("OwnerId")
730
+                        .OnDelete(DeleteBehavior.Cascade);
731
+
732
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Region")
733
+                        .WithMany()
734
+                        .HasForeignKey("RegionId")
735
+                        .OnDelete(DeleteBehavior.Cascade);
736
+
737
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
738
+                        .WithMany()
739
+                        .HasForeignKey("StatusId")
740
+                        .OnDelete(DeleteBehavior.Cascade);
741
+                });
742
+
743
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
744
+                {
745
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.UnitConfiguration", "UnitConfiguration")
746
+                        .WithMany("Types")
747
+                        .HasForeignKey("UnitConfigurationId")
748
+                        .OnDelete(DeleteBehavior.Cascade);
749
+                });
750
+
751
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
752
+                {
753
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
754
+                        .WithMany("Agents")
755
+                        .HasForeignKey("AgencyId");
756
+
757
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
758
+                        .WithMany()
759
+                        .HasForeignKey("UserId")
760
+                        .OnDelete(DeleteBehavior.Cascade);
761
+                });
762
+
763
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
764
+                {
765
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
766
+                        .WithMany()
767
+                        .HasForeignKey("UserId")
768
+                        .OnDelete(DeleteBehavior.Cascade);
769
+                });
770
+#pragma warning restore 612, 618
771
+        }
772
+    }
773
+}

+ 1
- 1
UnivateProperties_API/Model/BaseEntity.cs View File

@@ -5,7 +5,7 @@ using UnivateProperties_API.Containers;
5 5
 
6 6
 namespace UnivateProperties_API.Model
7 7
 {
8
-    public class BaseEntity
8
+    public abstract class BaseEntity
9 9
     {
10 10
         #region Properties
11 11
         [DatabaseGenerated(DatabaseGeneratedOption.Identity)]

+ 7
- 5
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs View File

@@ -10,11 +10,11 @@ namespace UnivateProperties_API.Model.Timeshare
10 10
         #region Properties
11 11
         public bool ReferedByAgent { get; set; }
12 12
         [ForeignKey("Agent")]
13
-        public int AgentId { get; set; }
13
+        public int? AgentId { get; set; }
14 14
         [ForeignKey("Agency")]
15
-        public int AgencyId { get; set; }
16
-        [ForeignKey("UnitConfiguration")]
17
-        public int UnitConfigurationId { get; set; }
15
+        public int? AgencyId { get; set; }
16
+        [ForeignKey("Owner")]
17
+        public int OwnerId { get; set; }
18 18
 
19 19
         public bool OtherResort { get; set; }
20 20
         public string ResortCode { get; set; }
@@ -23,6 +23,8 @@ namespace UnivateProperties_API.Model.Timeshare
23 23
         public int RegionId { get; set; }
24 24
         public string Season { get; set; }
25 25
         public string Module { get; set; }
26
+        public int Bedrooms { get; set; }
27
+        public int MaxSleep { get; set; }
26 28
         public string WeekNumber { get; set; }
27 29
         public double LevyAmount { get; set; }
28 30
 
@@ -43,9 +45,9 @@ namespace UnivateProperties_API.Model.Timeshare
43 45
         #region Navigation
44 46
         public virtual Status Status { get; set; }
45 47
         public virtual Province Region { get; set; }
48
+        public virtual User Owner { get; set; }
46 49
         public virtual Agent Agent { get; set; }
47 50
         public virtual Agency Agency { get; set; }
48
-        public virtual UnitConfiguration UnitConfiguration { get; set; }
49 51
         #endregion Navigation
50 52
     }
51 53
 }

+ 3
- 1
UnivateProperties_API/Model/Users/Person.cs View File

@@ -1,5 +1,7 @@
1
-using System.ComponentModel.DataAnnotations;
1
+using System.Collections.Generic;
2
+using System.ComponentModel.DataAnnotations;
2 3
 using System.ComponentModel.DataAnnotations.Schema;
4
+using UnivateProperties_API.Model.Timeshare;
3 5
 
4 6
 namespace UnivateProperties_API.Model.Users
5 7
 {

+ 1
- 0
UnivateProperties_API/Repository/Properties/IPropertyRepository.cs View File

@@ -11,6 +11,7 @@ namespace UnivateProperties_API.Repository.Properties
11 11
         List<PropertyDisplay> GetDisplay(Func<Property, bool> where);
12 12
         List<PropertyDisplay> GetDisplay(string Keyword);
13 13
         List<PropertyDisplay> GetDisplay(string type, string propertyType, string province, string city, string suburb, string propType);
14
+        List<PropertyDisplay> GetLatestDisplay();
14 15
         List<PropertyType> GetPropertyTypes(Func<PropertyType, bool> where);
15 16
     }
16 17
 }

+ 6
- 0
UnivateProperties_API/Repository/Properties/PropertyRepository.cs View File

@@ -352,5 +352,11 @@ namespace UnivateProperties_API.Repository.Properties
352 352
 
353 353
             return list;
354 354
         }
355
+
356
+        public List<PropertyDisplay> GetLatestDisplay()
357
+        {
358
+            List<Property> props = GetAll().OrderBy(x => x.Created).Take(3).ToList();
359
+            return GetDisplayDetails(props);
360
+        }
355 361
     }
356 362
 }

+ 2
- 1
UnivateProperties_API/Repository/Region/ProvinceRepository.cs View File

@@ -28,11 +28,12 @@ namespace UnivateProperties_API.Repository.Region
28 28
 
29 29
         public Province GetDetailed(Func<Province, bool> first)
30 30
         {
31
-            throw new NotImplementedException();
31
+            return dBContext.Provinces.FirstOrDefault(first);
32 32
         }
33 33
 
34 34
         public List<Province> GetDetailedAll()
35 35
         {
36
+            //TODO: remove NotImplemented
36 37
             throw new NotImplementedException();
37 38
         }
38 39
 

+ 5
- 0
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs View File

@@ -54,6 +54,7 @@ namespace UnivateProperties_API.Repository.Timeshare
54 54
                 StatusRepository statusRepo = new StatusRepository(_dbContext);
55 55
                 week.Status = statusRepo.GetDetailed(x => x.Id == week.StatusId);
56 56
             }
57
+
57 58
             return week;
58 59
         }
59 60
 
@@ -78,6 +79,10 @@ namespace UnivateProperties_API.Repository.Timeshare
78 79
         public void Insert(TimeshareWeek item)
79 80
         {
80 81
             item = GetWeekDetailed(item);
82
+            // Set starting Status of A1
83
+            StatusRepository repo = new StatusRepository(_dbContext);
84
+            item.Status = repo.GetDetailed(s => s.Code == "A1");
85
+            item.StatusId = item.Status.Id;
81 86
             _dbContext.Add(item);
82 87
             Save();
83 88
         }

+ 2
- 2
UnivateProperties_API/Repository/Users/AgencyRepository.cs View File

@@ -30,8 +30,8 @@ namespace UnivateProperties_API.Repository.Users
30 30
         public Agency GetDetailed(Func<Agency, bool> first)
31 31
         {
32 32
             var item = _dbContext.Agencies.FirstOrDefault(first);
33
-            AgencyRepository account = new AgencyRepository(_dbContext);
34
-            item = GetDetailedObject(item, account);
33
+            //AgencyRepository account = new AgencyRepository(_dbContext);
34
+            //item = GetDetailedObject(item, account);
35 35
             return item;
36 36
         }
37 37
 

+ 2
- 2
UnivateProperties_API/Repository/Users/AgentRepository.cs View File

@@ -29,8 +29,8 @@ namespace UnivateProperties_API.Repository.Users
29 29
         public Agent GetDetailed(Func<Agent, bool> first)
30 30
         {
31 31
             var item = _dbContext.Agents.FirstOrDefault(first);
32
-            AgentRepository account = new AgentRepository(_dbContext);
33
-            item = GetDetailedObject(item, account);
32
+            //AgentRepository account = new AgentRepository(_dbContext);
33
+            //item = GetDetailedObject(item, account);
34 34
             return item;
35 35
         }
36 36
 

Loading…
Cancel
Save