예제 #1
0
 public void Mutation_UpdateRoom()
 {
     Database.WriteAsync(realm => realm.Add(new Room
     {
         Id       = 30,
         IsActive = true,
         Name     = "Tên phòng",
         Floor    = FloorBusiness.Get(1),
         RoomKind = RoomKindBusiness.Get(1)
     })).Wait();
     SchemaHelper.Execute(
         @"/_GraphQL/Room/mutation.updateRoom.gql",
         @"/_GraphQL/Room/mutation.updateRoom.schema.json",
         new
     {
         input = new
         {
             id       = 30,
             name     = "Phòng 2",
             roomKind = new
             {
                 id = 1
             },
             floor = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManageMap = true
         );
 }
예제 #2
0
        public void Mutation_Login()
        {
            Database.WriteAsync(realm =>
            {
                realm.Add(new Employee
                {
                    Id           = "user",
                    Address      = "Địa chỉ",
                    IsActive     = true,
                    Birthdate    = DateTimeOffset.Now,
                    Email        = "*****@*****.**",
                    Gender       = true,
                    Name         = "Quản trị viên",
                    IdentityCard = "123456789",
                    Password     = CryptoHelper.Encrypt("123"),
                    PhoneNumber  = "+84 0123456789",
                    Position     = PositionDataAccess.Get(1),
                    StartingDate = DateTimeOffset.Now
                });
            }).Wait();

            SchemaHelper.Execute(
                @"/_GraphQL/Authentication/mutation.login.gql",
                @"/_GraphQL/Authentication/mutation.login.schema.json",
                new
            {
                id       = "user",
                password = "******"
            }
                );
        }
예제 #3
0
 public void Mutation_CreateEmployee()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Employee/mutation.createEmployee.gql",
         @"/_GraphQL/Employee/mutation.createEmployee.schema.json",
         new
     {
         input = new
         {
             id           = "nhanvien",
             password     = "******",
             name         = "Tên nhân viên",
             identityCard = "12345678",
             gender       = true,
             email        = "*****@*****.**",
             phoneNumber  = "123456789",
             address      = "164/54",
             birthdate    = "04-04-1996",
             startingDate = "10-10-2015",
             position     = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManageEmployee = true
         );
 }
예제 #4
0
 public void Mutation_CreatePosition()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Position/mutation.createPosition.gql",
         @"/_GraphQL/Position/mutation.createPosition.schema.json",
         new
     {
         input = new
         {
             name = "Tên quyền",
             permissionCleaning             = true,
             permissionGetAccountingVoucher = true,
             permissionGetHouseKeeping      = true,
             permissionGetMap            = true,
             permissionGetPatron         = true,
             permissionGetRate           = true,
             permissionGetService        = true,
             permissionManageEmployee    = true,
             permissionManageRentingRoom = true,
             permissionManageMap         = true,
             permissionManagePatron      = true,
             permissionManagePatronKind  = true,
             permissionManagePosition    = true,
             permissionManageRate        = true,
             permissionManageService     = true
         }
     },
         p => p.PermissionManagePosition = true
         );
 }
예제 #5
0
        public void Mutation_ResetPassword()
        {
            Database.WriteAsync(realm =>
            {
                realm.Add(new Employee
                {
                    Id           = "nhanvien_2",
                    Address      = "Địa chỉ",
                    IsActive     = true,
                    Birthdate    = DateTimeOffset.Now,
                    Email        = "*****@*****.**",
                    Gender       = true,
                    Name         = "Quản trị viên",
                    IdentityCard = "123456789",
                    Password     = CryptoHelper.Encrypt("12345678"),
                    PhoneNumber  = "+84 0123456789",
                    Position     = PositionBusiness.Get(1),
                    StartingDate = DateTimeOffset.Now
                });
            }).Wait();

            SchemaHelper.Execute(
                @"/_GraphQL/Employee/mutation.resetPassword.gql",
                @"/_GraphQL/Employee/mutation.resetPassword.schema.json",
                new { id = "nhanvien_2" },
                p => p.PermissionManageEmployee = true
                );
        }
예제 #6
0
        public void Mutation_UpdateService()
        {
            Database.WriteAsync(realm => realm.Add(new Service
            {
                Id       = 30,
                IsActive = true,
                Name     = "Tên dịch vụ",
                Unit     = "Đơn vị"
            })).Wait();

            SchemaHelper.Execute(
                @"/_GraphQL/Service/mutation.updateService.gql",
                @"/_GraphQL/Service/mutation.updateService.schema.json",
                new
            {
                input = new
                {
                    id       = 30,
                    name     = "Tên dịch vụ",
                    unitRate = 30000,
                    unit     = "Đơn vị tính"
                }
            },
                p => p.PermissionManageService = true
                );
        }
예제 #7
0
 public void Mutation_CreateVolatilityRate()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/VolatilityRate/mutation.createVolatilityRate.gql",
         @"/_GraphQL/VolatilityRate/mutation.createVolatilityRate.schema.json",
         new
     {
         input = new
         {
             dayRate              = 1,
             nightRate            = 1,
             weekRate             = 1,
             monthRate            = 1,
             lateCheckOutFee      = 1,
             earlyCheckInFee      = 1,
             effectiveStartDate   = "0001-01-01T00:00:00+00:00",
             effectiveEndDate     = "0001-01-01T00:00:00+00:00",
             effectiveOnMonday    = true,
             effectiveOnTuesday   = true,
             effectiveOnWednesday = true,
             effectiveOnThursday  = true,
             effectiveOnFriday    = true,
             effectiveOnSaturday  = true,
             effectiveOnSunday    = true,
             roomKind             = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManageRate = true
         );
 }
예제 #8
0
        public void Mutation_AddBookingToBill()
        {
            Database.WriteAsync(realm => realm.Add(new Room
            {
                Id       = 200,
                IsActive = true,
                Name     = "Tên phòng",
                Floor    = FloorBusiness.Get(1),
                RoomKind = RoomKindBusiness.Get(1)
            })).Wait();

            SchemaHelper.Execute(
                @"/_GraphQL/Booking/mutation.addBookingToBill.gql",
                @"/_GraphQL/Booking/mutation.addBookingToBill.schema.json",
                new
            {
                booking = new
                {
                    bookCheckInTime  = DateTimeOffset.Now.AddDays(1),
                    bookCheckOutTime = DateTimeOffset.Now.AddDays(2),
                    room             = new { id = 200 },
                    listOfPatrons    = new[]
                    {
                        new { id = 1 }
                    }
                },
                bill = new
                {
                    id = 1
                }
            },
                p => p.PermissionManageRentingRoom = true
                );
        }
예제 #9
0
 public void Mutation_CreatePatron()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Patron/mutation.createPatron.gql",
         @"/_GraphQL/Patron/mutation.createPatron.schema.json",
         new
     {
         input = new
         {
             identification     = "1234243",
             name               = "Tên khách hàng",
             email              = "email khách hàng",
             gender             = true,
             birthdate          = DateTimeOffset.FromUnixTimeSeconds(857293200),
             residence          = "Hộ khẩu",
             domicile           = "Nguyên quán",
             listOfPhoneNumbers = new[] { "1234", "123445" },
             nationality        = "Quốc tịch",
             company            = "BOSCH",
             note               = "Ghi chú",
             patronKind         = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManagePatron = true
         );
 }
예제 #10
0
 public void Query_HouseKeepings()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/HouseKeeping/query.houseKeepings.gql",
         @"/_GraphQL/HouseKeeping/query.houseKeepings.schema.json"
         );
 }
예제 #11
0
 public void Mutation_ConfirmCleanedAndServices()
 {
     Database.WriteAsync(realm => realm.Add(new HouseKeeping
     {
         Id       = 30,
         Status   = (int)HouseKeeping.StatusEnum.Cleaning,
         Type     = (int)HouseKeeping.TypeEnum.ExpectedDeparture,
         Employee = EmployeeBusiness.Get("admin"),
         Booking  = BookingBusiness.Get(1)
     })).Wait();
     SchemaHelper.Execute(
         @"/_GraphQL/HouseKeeping/mutation.confirmCleanedAndServices.gql",
         @"/_GraphQL/HouseKeeping/mutation.confirmCleanedAndServices.schema.json",
         new
     {
         servicesDetails = new[]
         {
             new
             {
                 number  = 1,
                 service = new { id = 1 }
             },
             new
             {
                 number  = 2,
                 service = new { id = 1 }
             }
         },
         houseKeepingId = 30
     },
         p => p.PermissionCleaning = true
         );
 }
예제 #12
0
 public void Mutation_UpdateRate()
 {
     Database.WriteAsync(realm => realm.Add(new Rate
     {
         Id       = 20,
         RoomKind = RoomKindBusiness.Get(1),
         Employee = EmployeeBusiness.Get("admin")
     })).Wait();
     SchemaHelper.Execute(
         @"/_GraphQL/Rate/mutation.updateRate.gql",
         @"/_GraphQL/Rate/mutation.updateRate.schema.json",
         new
     {
         input = new
         {
             id                 = 20,
             dayRate            = 5,
             nightRate          = 5,
             weekRate           = 5,
             monthRate          = 5,
             lateCheckOutFee    = 5,
             earlyCheckInFee    = 5,
             effectiveStartDate = DateTimeOffset.MinValue,
             roomKind           = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManageRate = true
         );
 }
예제 #13
0
 public void Mutation_CreateRate()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Rate/mutation.createRate.gql",
         @"/_GraphQL/Rate/mutation.createRate.schema.json",
         new
     {
         input = new
         {
             dayRate            = 1,
             nightRate          = 1,
             weekRate           = 1,
             monthRate          = 1,
             lateCheckOutFee    = 1,
             earlyCheckInFee    = 1,
             effectiveStartDate = "0001-01-01T00:00:00+00:00",
             roomKind           = new
             {
                 id = 1
             }
         }
     },
         p => p.PermissionManageRate = true
         );
 }
예제 #14
0
        public void Mutation_UpdateRoomKind()
        {
            Database.WriteAsync(realm => realm.Add(new RoomKind
            {
                Id             = 30,
                Name           = "Tên loại phòng",
                AmountOfPeople = 1,
                NumberOfBeds   = 1,
                IsActive       = true
            })).Wait();

            SchemaHelper.Execute(
                @"/_GraphQL/RoomKind/mutation.updateRoomKind.gql",
                @"/_GraphQL/RoomKind/mutation.updateRoomKind.schema.json",
                new
            {
                input = new
                {
                    id             = 30,
                    name           = "Loại 2",
                    numberOfBeds   = 2,
                    amountOfPeople = 2
                }
            },
                p => p.PermissionManageMap = true
                );
        }
예제 #15
0
 public void Mutation_CheckLogin()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Authentication/mutation.checkLogin.gql",
         @"/_GraphQL/Authentication/mutation.checkLogin.schema.json",
         null
         );
 }
예제 #16
0
 public void Query_Bills()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Bill/query.bills.gql",
         @"/_GraphQL/Bill/query.bills.schema.json",
         null,
         p => p.PermissionGetAccountingVoucher = true
         );
 }
예제 #17
0
 public void Query_Floors()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Floor/query.floors.gql",
         @"/_GraphQL/Floor/query.floors.schema.json",
         null,
         p => p.PermissionGetMap = true
         );
 }
예제 #18
0
 public void Query_Bookings()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Booking/query.bookings.gql",
         @"/_GraphQL/Booking/query.bookings.schema.json",
         null,
         p => p.PermissionManageRentingRoom = true
         );
 }
예제 #19
0
 public void Query_VolatilityRates()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/VolatilityRate/query.volatilityRates.gql",
         @"/_GraphQL/VolatilityRate/query.volatilityRates.schema.json",
         null,
         p => p.PermissionGetRate = true
         );
 }
예제 #20
0
 public void Query_ServicesDetail()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/ServicesDetail/query.servicesDetail.gql",
         @"/_GraphQL/ServicesDetail/query.servicesDetail.schema.json",
         new { id = 1 },
         p => p.PermissionGetService = true
         );
 }
예제 #21
0
 public void Query_Employees()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Employee/query.employees.gql",
         @"/_GraphQL/Employee/query.employees.schema.json",
         null,
         p => p.PermissionManageEmployee = true
         );
 }
예제 #22
0
 public void Query_Employee()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Employee/query.employee.gql",
         @"/_GraphQL/Employee/query.employee.schema.json",
         new { id = "admin" },
         p => p.PermissionManageEmployee = true
         );
 }
예제 #23
0
 public void Query_RoomKinds()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/RoomKind/query.roomKinds.gql",
         @"/_GraphQL/RoomKind/query.roomKinds.schema.json",
         null,
         p => p.PermissionGetMap = true
         );
 }
예제 #24
0
 public void Query_Receipts()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Receipt/query.receipts.gql",
         @"/_GraphQL/Receipt/query.receipts.schema.json",
         null,
         p => p.PermissionGetAccountingVoucher = true
         );
 }
예제 #25
0
 public void Query_Positions()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Position/query.positions.gql",
         @"/_GraphQL/Position/query.positions.schema.json",
         null,
         p => p.PermissionManagePosition = true
         );
 }
예제 #26
0
 public void Query_Patrons()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Patron/query.patrons.gql",
         @"/_GraphQL/Patron/query.patrons.schema.json",
         null,
         p => p.PermissionGetPatron = true
         );
 }
예제 #27
0
 public void Query_Room()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Room/query.room.gql",
         @"/_GraphQL/Room/query.room.schema.json",
         new { id = 1 },
         p => p.PermissionGetMap = true
         );
 }
예제 #28
0
 public void Query_Services()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Service/query.services.gql",
         @"/_GraphQL/Service/query.services.schema.json",
         null,
         p => p.PermissionGetService = true
         );
 }
예제 #29
0
 public void Query_PatronKind()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/PatronKind/query.patronKind.gql",
         @"/_GraphQL/PatronKind/query.patronKind.schema.json",
         new { id = 1 },
         p => p.PermissionGetPatron = true
         );
 }
예제 #30
0
 public void Mutation_ChangePassword()
 {
     SchemaHelper.Execute(
         @"/_GraphQL/Authentication/mutation.changePassword.gql",
         @"/_GraphQL/Authentication/mutation.changePassword.schema.json",
         new
     {
         password    = "******",
         newPassword = "******"
     }
         );
 }