{"id":41035101,"url":"https://github.com/tourware/sails-hook-mixins","last_synced_at":"2026-01-22T10:32:05.535Z","repository":{"id":79588772,"uuid":"77833779","full_name":"tourware/sails-hook-mixins","owner":"tourware","description":"Mixins (horizontal inheritance) for sails models.","archived":false,"fork":false,"pushed_at":"2017-01-04T15:51:04.000Z","size":4,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-20T11:18:06.695Z","etag":null,"topics":["horizontal","inheritance","mixin-framework","mixins","sails-model","sailsjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tourware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-02T13:02:38.000Z","updated_at":"2023-10-10T13:44:07.000Z","dependencies_parsed_at":"2023-02-25T22:30:19.103Z","dependency_job_id":null,"html_url":"https://github.com/tourware/sails-hook-mixins","commit_stats":null,"previous_names":["typischtouristik/sails-hook-mixins"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tourware/sails-hook-mixins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourware%2Fsails-hook-mixins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourware%2Fsails-hook-mixins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourware%2Fsails-hook-mixins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourware%2Fsails-hook-mixins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tourware","download_url":"https://codeload.github.com/tourware/sails-hook-mixins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourware%2Fsails-hook-mixins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28661874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["horizontal","inheritance","mixin-framework","mixins","sails-model","sailsjs"],"created_at":"2026-01-22T10:32:04.949Z","updated_at":"2026-01-22T10:32:05.530Z","avatar_url":"https://github.com/tourware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.typisch-touristik.de\"\u003e\n    \u003cimg alt=\"Typisch Touristik\" src=\"https://s3.eu-central-1.amazonaws.com/typischtouristik/logo_typisch-touristik_1200x443.png\" width=\"200\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  Mixins (horizontal inheritance) for sails models.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://travis-ci.org/TypischTouristik/sails-hook-mixins\" target=\"_blank\"\u003e\u003cimg alt=\"Travis Status\" src=\"https://travis-ci.org/TypischTouristik/sails-hook-mixins.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://david-dm.org/TypischTouristik/sails-hook-mixins\" target=\"_blank\"\u003e\u003cimg alt=\"Dependency Status\" src=\"https://david-dm.org/TypischTouristik/sails-hook-mixins.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/TypischTouristik/sails-hook-mixins/releases\"\u003e\u003cimg alt=\"Version Status\" src=\"https://badge.fury.io/gh/TypischTouristik%2Fsails-hook-mixins.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Getting started\n\n* Add a folder `api/mixins/` to your project\n* Add you first mixin, for example `api/mixins/hasCoordinates.js`\n* Define your attributes which are used by multiple models\n\n#### Defining shared attributes\n\nLets take our example: `api/mixins/hasCoordinates.js`\n\n```js\nmodule.exports = {\n\n  attributes: {\n    lat: {\n      type: 'float'\n    },\n\n    lng: {\n      type: 'float'\n    }\n\n};\n```\n\n#### Use the mixin in the model\n\nFor example the an address model `api/models/Address.js` needs the `lat` and `lng` attributes:\n\n```js\nmodule.exports = {\n\n  mixins: [\n    'hasCoordinates'\n  ],\n\n  attributes: {\n    street: {\n      type: 'string',\n      required: true\n    },\n\n    zipcode: {\n      type: 'string'\n    },\n\n    city: {\n      type: 'string'\n    }\n  }\n};\n```\n\nand a Point Of Interest model needs the `lat` and `lng` attributes:: `api/models/PointOfInterest.js`\n\n```js\nmodule.exports = {\n\n  mixins: [\n    'hasCoordinates'\n  ],\n\n  attributes: {\n    title: {\n      type: 'string',\n      required: true\n    },\n\n    description: {\n      type: 'string'\n    }\n  }\n};\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftourware%2Fsails-hook-mixins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftourware%2Fsails-hook-mixins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftourware%2Fsails-hook-mixins/lists"}