-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from CA-G12/52-add-fake-data
Add fake data
- Loading branch information
Showing
11 changed files
with
145 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import sequelize from "./connection"; | ||
import sequelize from './connection'; | ||
import { | ||
Announcements, Advertisements, | ||
} from './fakeData'; | ||
|
||
import { | ||
Announcement, Advertisement, | ||
} from '../../models/index'; | ||
|
||
const dbConnect = () => sequelize.sync(); | ||
const insertDB = async () => { | ||
try { | ||
await sequelize.sync({ force: true }); | ||
await Announcement.bulkCreate(Announcements); | ||
await Advertisement.bulkCreate(Advertisements); | ||
|
||
export { dbConnect } | ||
// eslint-disable-next-line no-console | ||
console.log('Build Database Successfully'); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.log('Build Database Failed', err); | ||
} | ||
}; | ||
insertDB(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// const AnnouncementsType = { | ||
// title: string, | ||
// startDate: string, | ||
// endDate: string, | ||
// }; | ||
const Announcements = [ | ||
{ | ||
title: 'تنبيه لسكان البرج الكرام: فصل الطاقة الشمسية على الساعة السابعة مساء اليوم', | ||
start_date: '20/10/2022', | ||
end_date: '21/10/2022', | ||
}, | ||
{ | ||
title: ' تنبيه لسكان البرج الكرام: نعلمكم بأنه سيتم اليوم اغلاق المصعد لأغراض الصيانة على الساعة السادسة مساء لمدة ساعة', | ||
start_date: '20/10/2022', | ||
end_date: '21/10/2022', | ||
}, | ||
{ | ||
title: 'اليوم سيتم الاحتفال بذكرى انشاء البرج الثالثة الساعة السابعة مساء على الروف نتمنى حضوركم', | ||
start_date: '20/10/2022', | ||
end_date: '21/10/2022', | ||
}, | ||
]; | ||
|
||
const Advertisements = [ | ||
{ | ||
title: 'شقة متاحة', | ||
description: ' متاح لدينا شقة فارغة بمساحة 140 متر مربع تحتوي على 3 غرف نوم ومطبخ على الطابق الرابع للمزيد من المعلومات يرجى التواصل', | ||
start_date: '20/10/2022', | ||
end_date: '30/10/2022', | ||
image: 'https://images.pexels.com/photos/7534561/pexels-photo-7534561.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940', | ||
}, | ||
{ | ||
title: 'مطلوب عامل نظافة', | ||
description: 'البرج بحاجة الى عامل نظافة براتب 800 شيكل شهريا ', | ||
start_date: '20/10/2022', | ||
end_date: '30/10/2022', | ||
image: 'https://images.pexels.com/photos/6197123/pexels-photo-6197123.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', | ||
}, | ||
{ | ||
title: 'شقة متاحة ', | ||
description: 'متاح لدينا شقة فارغة بمساحة 190 متر مربع تحتوي على 3 غرف نوم ومطبخ على الطابق الخامس للمزيد من المعلومات يرجى التواصل', | ||
start_date: '20/10/2022', | ||
end_date: '30/10/2022', | ||
image: 'https://images.pexels.com/photos/5417293/pexels-photo-5417293.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500', | ||
}, | ||
|
||
]; | ||
|
||
export { Announcements, Advertisements }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DataTypes } from 'sequelize'; | ||
import sequelize from '../database/config/connection'; | ||
|
||
const Advertisement = sequelize.define('Advertisements', { | ||
id: { | ||
primaryKey: true, | ||
autoIncrement: true, | ||
type: DataTypes.INTEGER, | ||
}, | ||
title: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
description: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
start_date: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
end_date: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
image: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
}); | ||
|
||
export default Advertisement; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { DataTypes } from 'sequelize'; | ||
import sequelize from '../database/config/connection'; | ||
|
||
const Announcement = sequelize.define('Announcements', { | ||
id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
title: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
start_date: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
end_date: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
}); | ||
|
||
export default Announcement; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Announcement from './Announcement'; | ||
import Advertisement from './Advertisement'; | ||
|
||
export { | ||
Announcement, Advertisement, | ||
}; |