generated from alkemyTech/base-ong-server-js
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ot 23 members model migration controller #25
Merged
soyarielruiz
merged 5 commits into
development
from
OT-23_Members_model-migration-controller
Sep 17, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23f08fe
se añadió el modelo, base del controlador y la migración de Members
Alvaro1599 bc0d95b
se añadió los seeders y el rollback, se eliminó el comentario
Alvaro1599 b3260af
Merge remote-tracking branch 'origin/development' into OT-23_Members_…
Alvaro1599 c9e84d5
se actualizó con la rama development se añadió campos que permitan el…
Alvaro1599 31d1299
se cambio la forma de instaciar MemberController
Alvaro1599 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { Members: Member } = require("../models").sequelize.models | ||
|
||
class MemberController { | ||
|
||
} | ||
|
||
module.exports = MemberController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.createTable('Members', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
allowNull: false, | ||
type: Sequelize.STRING | ||
}, | ||
facebookUrl: { | ||
allowNull: true, | ||
type: Sequelize.STRING | ||
}, | ||
instagramUrl: { | ||
allowNull: true, | ||
type: Sequelize.STRING | ||
}, | ||
linkedinUrl: { | ||
allowNull: true, | ||
type: Sequelize.STRING | ||
}, | ||
image: { | ||
allowNull: false, | ||
type: Sequelize.STRING | ||
}, | ||
description: { | ||
allowNull: true, | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE | ||
}, | ||
deletedAt: { | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.dropTable('Members'); | ||
} | ||
}; |
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,54 @@ | ||
'use strict'; | ||
const { | ||
Model | ||
} = require('sequelize'); | ||
module.exports = (sequelize, DataTypes) => { | ||
class Member extends Model { | ||
/** | ||
* Helper method for defining associations. | ||
* This method is not a part of Sequelize lifecycle. | ||
* The `models/index` file will call this method automatically. | ||
*/ | ||
static associate(models) { | ||
// define association here | ||
} | ||
}; | ||
Member.init({ | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: DataTypes.INTEGER | ||
}, | ||
name: { | ||
allowNull: false, | ||
type: DataTypes.STRING | ||
}, | ||
facebookUrl: { | ||
allowNull: true, | ||
type: DataTypes.STRING | ||
}, | ||
instagramUrl: { | ||
allowNull: true, | ||
type: DataTypes.STRING | ||
}, | ||
linkedinUrl: { | ||
allowNull: true, | ||
type: DataTypes.STRING | ||
}, | ||
image: { | ||
allowNull: false, | ||
type: DataTypes.STRING | ||
}, | ||
description: { | ||
allowNull: true, | ||
type: DataTypes.STRING | ||
}, | ||
deletedAt: DataTypes.DATE | ||
}, { | ||
sequelize, | ||
modelName: 'Member', | ||
paranoid: true | ||
}); | ||
return Member; | ||
}; |
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,78 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.bulkInsert('Members', [{ | ||
name: 'Member', | ||
facebookUrl: 'https://www.facebook.com/member/', | ||
instagramUrl: 'https://www.instagram.com/member/', | ||
linkedinUrl: 'https://www.linkedin.com/member/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
}, | ||
{ | ||
name: 'Member1', | ||
facebookUrl: 'https://www.facebook.com/member1/', | ||
instagramUrl: 'https://www.instagram.com/member1/', | ||
linkedinUrl: 'https://www.linkedin.com/member1/', | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
}, { | ||
name: 'Member2', | ||
facebookUrl: 'https://www.facebook.com/member2/', | ||
instagramUrl: 'https://www.instagram.com/member2/', | ||
linkedinUrl: 'https://www.linkedin.com/member2/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
} | ||
, { | ||
name: 'Member3', | ||
facebookUrl: 'https://www.facebook.com/member3/', | ||
instagramUrl: 'https://www.instagram.com/member3/', | ||
linkedinUrl: 'https://www.linkedin.com/member3/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
} | ||
, { | ||
name: 'Member4', | ||
facebookUrl: 'https://www.facebook.com/member4/', | ||
instagramUrl: 'https://www.instagram.com/member4/', | ||
linkedinUrl: 'https://www.linkedin.com/member4/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
} | ||
, { | ||
name: 'Member5', | ||
facebookUrl: 'https://www.facebook.com/member5/', | ||
instagramUrl: 'https://www.instagram.com/member5/', | ||
linkedinUrl: 'https://www.linkedin.com/member5/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
}, | ||
{ | ||
name: 'Member6', | ||
facebookUrl: 'https://www.facebook.com/member6/', | ||
instagramUrl: 'https://www.instagram.com/member6/', | ||
linkedinUrl: 'https://www.linkedin.com/member6/', | ||
description: "this is a description", | ||
image: 'https://www.designevo.com/res/templates/thumb_small/colorful-hand-and-warm-community.png', | ||
createdAt: new Date, | ||
updatedAt: new Date, | ||
}], {}); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.bulkDelete('Members', null, {}); | ||
} | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: borrar comentarios innecesarios.