<commit_before>import net.okjsp.*
import grails.converters.JSON

class BootStrap {

    UserService userService

    def init = { servletContext ->

//        SpringSecurityUtils.clientRegisterFilter('cookiePreAuthFilter', SecurityFilterPosition.PRE_AUTH_FILTER)

        def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
        def userRole = new Role(authority: 'ROLE_USER').save(flush: true)

        environments {
            development {
                if(!User.findByUsername('admin')) {

                    // 테스트 User 생성
                    def adminUser = new User(
                        username: 'admin',
                        password: '<PASSWORD>',
                        person: new Person(fullName: '관리자', email: '<EMAIL>'),
                        avatar: new Avatar(nickname: '관리자')
                    )
                    adminUser.enabled = true
                    adminUser.createIp = '0.0.0.0'
                    userService.saveUser adminUser
                    UserRole.create(adminUser, adminRole, true)
                }

                if(!User.findByUsername('testuser')) {

                    // 테스트 User 생성
                    def testUser = new User(
                        username: 'testuser',
                        password: '<PASSWORD>',
                        person: new Person(fullName: '테스트사용자', email: '<EMAIL>'),
                        avatar: new Avatar(nickname: '테스트사용자')
                    )

                    testUser.enabled = true
                    testUser.createIp = '0.0.0.0'
                    userService.saveUser testUser
                    UserRole.create(testUser, userRole, true)
                }
            }
        }

        // 1 Level Category
        def questionsCategory = Category.get('questions') ?: new Category(code: 'questions', labelCode: 'questions.label', defaultLabel: 'Q&A', iconCssNames: 'fa fa-database', sortOrder: 0, writable: true, useNote: true, useOpinion: true, useEvaluate: true, useTag: true, requireTag: true).save(flush: true)
        def techCategory = Category.get('tech') ?: new Category(code: 'tech', labelCode: 'tech.label', defaultLabel: 'Tech', iconCssNames: 'fa fa-code', sortOrder: 1, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)
        def communityCategory = Category.get('community') ?: new Category(code: 'community', labelCode: 'community.label', defaultLabel: '커뮤니티', iconCssNames: 'fa fa-comments', sortOrder: 2, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: false).save(flush: true)
        def columnsCategory = Category.get('columns') ?: new Category(code: 'columns', labelCode: 'columns.label', defaultLabel: '칼럼', iconCssNames: 'fa fa-quote-left', sortOrder: 3, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)
        def jobsCategory = Category.get('jobs') ?: new Category(code: 'jobs', labelCode: 'jobs.label', defaultLabel: 'Jobs', iconCssNames: 'fa fa-group', sortOrder: 4, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)

        // 2 Level Category
<commit_msg>bootstrap 카테고리 정보 수정<commit_after>import net.okjsp.*
import grails.converters.JSON

class BootStrap {

    UserService userService

    def init = { servletContext ->

//        SpringSecurityUtils.clientRegisterFilter('cookiePreAuthFilter', SecurityFilterPosition.PRE_AUTH_FILTER)

        def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
        def userRole = new Role(authority: 'ROLE_USER').save(flush: true)

        environments {
            development {
                if(!User.findByUsername('admin')) {

                    // 테스트 User 생성
                    def adminUser = new User(
                        username: 'admin',
                        password: '<PASSWORD>',
                        person: new Person(fullName: '관리자', email: '<EMAIL>'),
                        avatar: new Avatar(nickname: '관리자')
                    )
                    adminUser.enabled = true
                    adminUser.createIp = '0.0.0.0'
                    userService.saveUser adminUser
                    UserRole.create(adminUser, adminRole, true)
                }

                if(!User.findByUsername('testuser')) {

                    // 테스트 User 생성
                    def testUser = new User(
                        username: 'testuser',
                        password: '<PASSWORD>',
                        person: new Person(fullName: '테스트사용자', email: '<EMAIL>'),
                        avatar: new Avatar(nickname: '테스트사용자')
                    )

                    testUser.enabled = true
                    testUser.createIp = '0.0.0.0'
                    userService.saveUser testUser
                    UserRole.create(testUser, userRole, true)
                }
            }
        }

        // 1 Level Category
        def questionsCategory = Category.get('questions') ?: new Category(code: 'questions', labelCode: 'questions.label', defaultLabel: 'Q&A', iconCssNames: 'fa fa-database', sortOrder: 0, writable: true, useNote: true, useOpinion: true, useEvaluate: true, useTag: true, requireTag: true).save(flush: true)
        def techCategory = Category.get('tech') ?: new Category(code: 'tech', labelCode: 'tech.label', defaultLabel: 'Tech', iconCssNames: 'fa fa-code', sortOrder: 1, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)
        def communityCategory = Category.get('community') ?: new Category(code: 'community', labelCode: 'community.label', defaultLabel: '커뮤니티', iconCssNames: 'fa fa-comments', sortOrder: 2, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: false).save(flush: true)
        def columnsCategory = Category.get('columns') ?: new Category(code: 'columns', labelCode: 'columns.label', defaultLabel: '칼럼', iconCssNames: 'fa fa-quote-left', sortOrder: 3, writable: true, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)
        def jobsCategory = Category.get('jobs') ?: new Category(code: 'jobs', labelCode: 'jobs.label', defaultLabel: 'Jobs', iconCssNames: 'fa fa-group', sortOrder: 4, writable: false, useNote: true, useOpinion: false, useEvaluate: false, useTag: true).save(flush: true)

        // 2 Level Category

{'fraction_non_alphanumeric': 0.11985134716630536, 'fraction_numerical': 0.004645401052957572, 'mean_word_length': 2.2392176529588768, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3606452', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1863, 'n_words': 457}