diff --git a/core/server/data/migrations/versions/4.46/2022-04-13-12-00-add-created-at-newsletters.js b/core/server/data/migrations/versions/4.46/2022-04-13-12-00-add-created-at-newsletters.js new file mode 100644 index 0000000000..4f26c451b1 --- /dev/null +++ b/core/server/data/migrations/versions/4.46/2022-04-13-12-00-add-created-at-newsletters.js @@ -0,0 +1,6 @@ +const {createAddColumnMigration} = require('../../utils'); + +module.exports = createAddColumnMigration('newsletters', 'created_at', { + type: 'dateTime', + nullable: false +}); diff --git a/core/server/data/migrations/versions/4.46/2022-04-13-12-01-add-updated-at-newsletters.js b/core/server/data/migrations/versions/4.46/2022-04-13-12-01-add-updated-at-newsletters.js new file mode 100644 index 0000000000..3cff45b797 --- /dev/null +++ b/core/server/data/migrations/versions/4.46/2022-04-13-12-01-add-updated-at-newsletters.js @@ -0,0 +1,6 @@ +const {createAddColumnMigration} = require('../../utils'); + +module.exports = createAddColumnMigration('newsletters', 'updated_at', { + type: 'dateTime', + nullable: true +}); diff --git a/core/server/data/schema/schema.js b/core/server/data/schema/schema.js index 290b63ee1e..ce81c182c3 100644 --- a/core/server/data/schema/schema.js +++ b/core/server/data/schema/schema.js @@ -34,7 +34,9 @@ module.exports = { body_font_category: {type: 'string', maxlength: 191, nullable: false, defaultTo: 'sans_serif', validations: {isIn: [['serif', 'sans_serif']]}}, footer_content: {type: 'text', maxlength: 1000000000, nullable: true}, show_badge: {type: 'bool', nullable: false, defaultTo: true}, - show_header_name: {type: 'bool', nullable: false, defaultTo: true} + show_header_name: {type: 'bool', nullable: false, defaultTo: true}, + created_at: {type: 'dateTime', nullable: false}, + updated_at: {type: 'dateTime', nullable: true} }, posts: { id: {type: 'string', maxlength: 24, nullable: false, primary: true}, diff --git a/test/e2e-api/admin/__snapshots__/members.test.js.snap b/test/e2e-api/admin/__snapshots__/members.test.js.snap index 5b96cffa6a..fef15d18c8 100644 --- a/test/e2e-api/admin/__snapshots__/members.test.js.snap +++ b/test/e2e-api/admin/__snapshots__/members.test.js.snap @@ -2023,6 +2023,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -2042,6 +2043,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -2061,7 +2063,7 @@ exports[`Members API: with multiple newsletters Can add and edit with custom new Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "1169", + "content-length": "1249", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//, @@ -2089,6 +2091,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -2108,6 +2111,7 @@ Object { "subscribe_on_signup": false, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -2127,7 +2131,7 @@ exports[`Members API: with multiple newsletters Can add and edit with custom new Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "1168", + "content-length": "1248", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -2154,6 +2158,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -2173,10 +2178,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -2196,6 +2203,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -2215,7 +2223,7 @@ exports[`Members API: with multiple newsletters Can add with default newsletters Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "1674", + "content-length": "1834", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "location": StringMatching /https\\?:\\\\/\\\\/\\.\\*\\?\\\\/members\\\\/\\[a-f0-9\\]\\{24\\}\\\\//, @@ -2463,7 +2471,7 @@ exports[`Members API: with multiple newsletters Can filter on newsletter slug 2: Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "1748", + "content-length": "1908", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", diff --git a/test/e2e-api/admin/__snapshots__/newsletters.test.js.snap b/test/e2e-api/admin/__snapshots__/newsletters.test.js.snap index a2fd0021f2..217f69e978 100644 --- a/test/e2e-api/admin/__snapshots__/newsletters.test.js.snap +++ b/test/e2e-api/admin/__snapshots__/newsletters.test.js.snap @@ -10,6 +10,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -29,6 +30,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -39,7 +41,7 @@ exports[`Newsletters API Can add a newsletter - with custom sender_email 2: [hea Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "628", + "content-length": "708", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "location": Any, @@ -63,6 +65,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -82,10 +85,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -105,10 +110,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -128,10 +135,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -151,10 +160,12 @@ Object { "subscribe_on_signup": false, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -174,6 +185,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -184,7 +196,7 @@ exports[`Newsletters API Can add a newsletter - with custom sender_email 4: [hea Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "2735", + "content-length": "3135", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -197,6 +209,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -216,6 +229,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -226,7 +240,7 @@ exports[`Newsletters API Can add a newsletter 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "526", + "content-length": "606", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "location": Any, @@ -250,6 +264,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -269,10 +284,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -292,10 +309,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -315,10 +334,12 @@ Object { "subscribe_on_signup": false, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -338,6 +359,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -348,7 +370,7 @@ exports[`Newsletters API Can add a newsletter 4: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "2176", + "content-length": "2496", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -371,6 +393,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -390,10 +413,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -413,10 +438,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -436,10 +463,12 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -459,10 +488,12 @@ Object { "subscribe_on_signup": false, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -482,6 +513,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -492,7 +524,7 @@ exports[`Newsletters API Can browse newsletters 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "2735", + "content-length": "3135", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -515,6 +547,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -534,6 +567,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -544,7 +578,7 @@ exports[`Newsletters API Can edit newsletters 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "618", + "content-length": "698", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -557,6 +591,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -576,6 +611,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -586,7 +622,7 @@ exports[`Newsletters API Can edit newsletters 4: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "539", + "content-length": "619", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -609,6 +645,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -628,6 +665,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -638,7 +676,7 @@ exports[`Newsletters API Can edit newsletters with updated sender_email 2: [head Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "623", + "content-length": "703", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -656,6 +694,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -675,6 +714,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -685,7 +725,7 @@ exports[`Newsletters API Can edit newsletters with updated sender_email 4: [head Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "591", + "content-length": "671", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -698,6 +738,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -717,6 +758,7 @@ Object { "subscribe_on_signup": false, "title_alignment": "center", "title_font_category": "serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], @@ -727,7 +769,7 @@ exports[`Newsletters API Can read a newsletter 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "539", + "content-length": "619", "content-type": "application/json; charset=utf-8", "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, "vary": "Origin, Accept-Encoding", @@ -740,6 +782,7 @@ Object { "newsletters": Array [ Object { "body_font_category": "sans_serif", + "created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "description": null, "footer_content": null, "header_image": null, @@ -759,6 +802,7 @@ Object { "subscribe_on_signup": true, "title_alignment": "center", "title_font_category": "sans_serif", + "updated_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}T\\\\d\\{2\\}:\\\\d\\{2\\}:\\\\d\\{2\\}\\\\\\.000Z/, "visibility": "members", }, ], diff --git a/test/e2e-api/admin/members.test.js b/test/e2e-api/admin/members.test.js index 9287b4a587..b588b3e494 100644 --- a/test/e2e-api/admin/members.test.js +++ b/test/e2e-api/admin/members.test.js @@ -29,6 +29,12 @@ async function getPaidProduct() { return await Product.findOne({type: 'paid'}); } +const newsletterSnapshot = { + id: anyObjectId, + created_at: anyISODateTime, + updated_at: anyISODateTime +}; + const memberMatcherNoIncludes = { id: anyObjectId, uuid: anyUuid, @@ -1402,9 +1408,7 @@ describe('Members API: with multiple newsletters', function () { updated_at: anyISODateTime, subscriptions: anyArray, labels: anyArray, - newsletters: Array(2).fill({ - id: matchers.anyObjectId - }) + newsletters: Array(2).fill(newsletterSnapshot) }] }) .matchHeaderSnapshot({ @@ -1449,9 +1453,7 @@ describe('Members API: with multiple newsletters', function () { updated_at: anyISODateTime, subscriptions: anyArray, labels: anyArray, - newsletters: Array(1).fill({ - id: matchers.anyObjectId - }) + newsletters: Array(1).fill(newsletterSnapshot) }] }) .matchHeaderSnapshot({ @@ -1477,9 +1479,7 @@ describe('Members API: with multiple newsletters', function () { updated_at: anyISODateTime, subscriptions: anyArray, labels: anyArray, - newsletters: Array(1).fill({ - id: matchers.anyObjectId - }) + newsletters: Array(1).fill(newsletterSnapshot) }] }) .matchHeaderSnapshot({ diff --git a/test/e2e-api/admin/newsletters.test.js b/test/e2e-api/admin/newsletters.test.js index 4c85ca27e4..a4bbe2e10d 100644 --- a/test/e2e-api/admin/newsletters.test.js +++ b/test/e2e-api/admin/newsletters.test.js @@ -1,9 +1,11 @@ const {agentProvider, mockManager, fixtureManager, matchers} = require('../../utils/e2e-framework'); -const {anyEtag, anyObjectId, anyString} = matchers; +const {anyEtag, anyObjectId, anyString, anyISODateTime} = matchers; const testUtils = require('../../utils'); const newsletterSnapshot = { - id: anyObjectId + id: anyObjectId, + created_at: anyISODateTime, + updated_at: anyISODateTime }; let agent; diff --git a/test/unit/server/data/schema/integrity.test.js b/test/unit/server/data/schema/integrity.test.js index d5e1a0d686..15ee636ea6 100644 --- a/test/unit/server/data/schema/integrity.test.js +++ b/test/unit/server/data/schema/integrity.test.js @@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route */ describe('DB version integrity', function () { // Only these variables should need updating - const currentSchemaHash = '0e37d7b946574478382c7506a9f5e588'; + const currentSchemaHash = '777e3e42ce2982d0ccae04982f353576'; const currentFixturesHash = '4924616fbc51dd0ccef62ae04b4708f9'; const currentSettingsHash = 'ffd899a82b0ad2886e92d8244bcbca6a'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';